Skip to content

Commit

Permalink
ci: refactor labeler workflow (#89)
Browse files Browse the repository at this point in the history
This aligns with how membership-checking and labeling is
done in the same workflow in other repos of ours.
  • Loading branch information
trentm authored Mar 19, 2024
1 parent f0ced2c commit 2086044
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,30 @@ on:
pull_request_target:
types: [opened]

# 'issues: write' for https://docs.github.com/en/rest/issues/labels?apiVersion=2022-11-28#add-labels-to-an-issue
# '*: write' permissions for https://docs.github.com/en/rest/issues/labels?apiVersion=2022-11-28#add-labels-to-an-issue
permissions:
contents: read
issues: write
pull_requests: write

jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Check team membership for user
uses: elastic/[email protected]
id: checkUserMember
- id: is_elastic_member
uses: elastic/apm-pipeline-library/.github/actions/is-member-elastic-org@current
with:
username: ${{ github.actor }}
team: 'apm'
usernamesToExclude: |
apmmachine
dependabot
dependabot[bot]
GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}
token: ${{ secrets.APM_TECH_USER_TOKEN }}

- name: Add community and triage labels
if: steps.checkUserMember.outputs.isTeamMember != 'true' && steps.checkUserMember.outputs.isExcluded != 'true'
uses: actions-ecosystem/action-add-labels@v1
if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]'
uses: actions/github-script@v7
with:
labels: |
community
triage
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["community", "triage"]
})

0 comments on commit 2086044

Please sign in to comment.