From 20f03aae023bf29e5b6c849bd12836fc43645739 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Tue, 12 Mar 2024 14:39:04 +0100 Subject: [PATCH 1/2] ci: update issue labeler workflow Stop using the apm group and custom github action to check if issues are from internal members or not. While at it remove posting internal pull requests on the old APM agent board. Fixes #2001 --- .github/community-label.yml | 5 ---- .github/labeler-config.yml | 3 --- .github/workflows/labeler.yml | 48 +++++++++++++---------------------- 3 files changed, 17 insertions(+), 39 deletions(-) delete mode 100644 .github/community-label.yml delete mode 100644 .github/labeler-config.yml diff --git a/.github/community-label.yml b/.github/community-label.yml deleted file mode 100644 index 8872df2d5..000000000 --- a/.github/community-label.yml +++ /dev/null @@ -1,5 +0,0 @@ -# add 'community' label to all new issues and PRs created by the community -community: - - '.*' -triage: - - '.*' \ No newline at end of file diff --git a/.github/labeler-config.yml b/.github/labeler-config.yml deleted file mode 100644 index a1e4dbc29..000000000 --- a/.github/labeler-config.yml +++ /dev/null @@ -1,3 +0,0 @@ -# add 'agent-python' label to all new issues -agent-python: - - '.*' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 377caaa5c..86f0738ea 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -4,43 +4,29 @@ on: types: [opened] pull_request_target: types: [opened] -env: - MY_GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }} + +# 'issues: write' for https://docs.github.com/en/rest/issues/labels?apiVersion=2022-11-28#add-labels-to-an-issue +permissions: + contents: read + issues: write + jobs: triage: runs-on: ubuntu-latest steps: - name: Add agent-python label - uses: AlexanderWert/issue-labeler@v2.3 + uses: actions-ecosystem/action-add-labels@v1 with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - configuration-path: .github/labeler-config.yml - enable-versioned-regex: 0 - - name: Check team membership for user - uses: elastic/get-user-teams-membership@1.1.0 - id: checkUserMember + labels: agent-python + - 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 - GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }} - - name: Show team membership - run: | - echo "::debug::isTeamMember: ${{ steps.checkUserMember.outputs.isTeamMember }}" - echo "::debug::isExcluded: ${{ steps.checkUserMember.outputs.isExcluded }}" - - name: Add community and triage lables - if: steps.checkUserMember.outputs.isTeamMember != 'true' && steps.checkUserMember.outputs.isExcluded != 'true' - uses: AlexanderWert/issue-labeler@v2.3 + token: ${{ secrets.APM_TECH_USER_TOKEN }} + - name: Add community and triage labels + if: contains(steps.is_elastic_member.outputs.result, 'false') && github.actor != 'dependabot[bot]' && github.actor != 'apmmachine' + uses: actions-ecosystem/action-add-labels@v1 with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - configuration-path: .github/community-label.yml - enable-versioned-regex: 0 - - name: Assign new internal pull requests to project - uses: elastic/assign-one-project-github-action@1.2.2 - if: (steps.checkUserMember.outputs.isTeamMember == 'true' || steps.checkUserMember.outputs.isExcluded == 'true') && github.event.pull_request - with: - project: 'https://github.com/orgs/elastic/projects/454' - project_id: '5882982' - column_name: 'In Progress' + labels: + - community + - triage From b579d4ea09f91cab2a3ea1cfd6827cb46ca03d95 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 14 Mar 2024 14:33:44 +0100 Subject: [PATCH 2/2] Update .github/workflows/labeler.yml Co-authored-by: Jan Calanog --- .github/workflows/labeler.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 86f0738ea..564cc7d31 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -9,6 +9,7 @@ on: permissions: contents: read issues: write + pull-requests: write jobs: triage: