mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
chore(github): add label to community contributed PRs (#9009)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
name: Label Community Contributors PRs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
add-community-label:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||
with:
|
||||
script: |
|
||||
// Get the author association from the event
|
||||
const association = context.payload.pull_request?.author_association ||
|
||||
context.payload.issue?.author_association;
|
||||
|
||||
// Members have associations like: OWNER, MEMBER, COLLABORATOR
|
||||
// Non-members have: CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR, FIRST_TIMER, NONE
|
||||
const memberAssociations = ['OWNER', 'MEMBER', 'COLLABORATOR'];
|
||||
|
||||
if (!memberAssociations.includes(association)) {
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: ['community']
|
||||
});
|
||||
|
||||
console.log(`Added 'community' label for ${association} contributor`);
|
||||
} else {
|
||||
console.log(`Skipped labeling for ${association}`);
|
||||
}
|
||||
Reference in New Issue
Block a user