mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-04 02:04:06 +00:00
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
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}`);
|
|
}
|