From c3694fdc5ba185fefd888177af787e2938d987b3 Mon Sep 17 00:00:00 2001 From: Andoni Alonso <14891798+andoniaf@users.noreply.github.com> Date: Mon, 27 Oct 2025 14:48:27 +0100 Subject: [PATCH] chore(github): add label to community contributed PRs (#9009) --- .github/workflows/labeler-community.yml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/labeler-community.yml diff --git a/.github/workflows/labeler-community.yml b/.github/workflows/labeler-community.yml new file mode 100644 index 0000000000..268f4f5ca8 --- /dev/null +++ b/.github/workflows/labeler-community.yml @@ -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}`); + }