Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix/refactor labeler workflow #3921

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +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: Add agent-nodejs label
uses: actions-ecosystem/action-add-labels@v1
with:
labels: agent-nodejs

- name: Check team membership for user
uses: elastic/get-user-teams-membership@1.1.0
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]'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you omit @apmmachine for a reason?

Copy link
Member Author

@trentm trentm Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am copying what apm-agent-java is doing, e.g.: https://github.com/elastic/apm-agent-java/blob/main/.github/workflows/labeler.yml#L33

Do we use apmmachine for creating issues or PRs? I don't see any: https://github.com/elastic/apm-agent-nodejs/issues?q=author%3A%40apmmachine+

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are still using it for updatecli workflows.

I think you need to remove the @ in the search.

https://github.com/elastic/apm-agent-nodejs/issues?q=author%3Aapmmachine+ shows the last PR in january.

Copy link
Member Author

@trentm trentm Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Presumably apm-agent-java will have the same issue, then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reakaleek Oh, actually, @apmmachine is a member of "elastic", so we don't need to explicitly handle excluding github.actor === 'apmmachine' in this test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. Makes sense.

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"]
})
Loading