diff --git a/.github/opened-pr-contribution-labeler.yml b/.github/opened-pr-contribution-labeler.yml new file mode 100644 index 0000000000..8d1b4b8ae4 --- /dev/null +++ b/.github/opened-pr-contribution-labeler.yml @@ -0,0 +1,5 @@ +# https://github.com/actions/labeler + +# Add 'Contribution' label to any opened PR when author external to team +"Contribution": + - "**/*" diff --git a/.github/opened-pr-labeler.yml b/.github/opened-pr-labeler.yml deleted file mode 100644 index 3b77ee3001..0000000000 --- a/.github/opened-pr-labeler.yml +++ /dev/null @@ -1,5 +0,0 @@ -# https://github.com/actions/labeler - -# Add 'Status: Do Not Merge' label to any newly opened PR -"Status: Do Not Merge": - - "**/*" diff --git a/.github/workflows/on_pull_request_open.yml b/.github/workflows/on_pull_request_open.yml index b76c95762e..02c2fe1ff6 100644 --- a/.github/workflows/on_pull_request_open.yml +++ b/.github/workflows/on_pull_request_open.yml @@ -2,16 +2,39 @@ name: Opened Pull Request Labeler on: pull_request: - types: [opened] + types: [opened, synchronize] jobs: - pr-triage: + pr-context-labeller: runs-on: ubuntu-latest steps: - - name: Auto labeller + - name: Assign Author + uses: technote-space/assign-author@v1 + + - name: Check user for team affiliation + uses: tspascoal/get-user-teams-membership@v2 + id: teamAffiliation + with: + GITHUB_TOKEN: "${{ secrets.PAT_GH_READ_ORG }}" + username: "${{ github.actor }}" + team: "Design Systems PD,design-systems,Design Systems Eng,Design Systems Eng Leads" + + - name: Debug in group + run: echo "${{ github.actor }} is team member ${{ steps.teamAffiliation.outputs.isTeamMember }}" + + - name: Check user for team affiliation + uses: tspascoal/get-user-teams-membership@v2 + id: teamAffiliationList + with: + GITHUB_TOKEN: "${{ secrets.PAT_GH_READ_ORG }}" + username: "${{ github.actor }}" + + - name: Debug groups + run: echo "${{ steps.teamAffiliationList.outputs.teams }}" + + - name: Auto contribution labeller + if: ${{ steps.teamAffiliation.outputs.isTeamMember == 'false' }} uses: actions/labeler@v4 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" - configuration-path: .github/opened-pr-labeler.yml - - name: Assign Author - uses: technote-space/assign-author@v1 + configuration-path: .github/opened-pr-contribution-labeler.yml