From 04d7a2dc7568458d1ab316ee45aaeef5a49cd573 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Tue, 7 Dec 2021 11:23:26 -0500 Subject: [PATCH 1/2] Use pull_request_target This allows PRs from forks to edit the PR. https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request_target --- .github/workflows/triage.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 7ded537a4..9378b4029 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -9,10 +9,9 @@ on: issues: types: - opened + - reopened - pull_request: - types: - - opened + pull_request_target: jobs: triage: From 4b3bde71884a6968479d46b48e8a51e9a639ddb8 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Tue, 7 Dec 2021 14:54:32 -0500 Subject: [PATCH 2/2] Use separate action for labeling issues Create separate config files for issue and PR labelers --- .github/issue-labeler.yml | 2 ++ .github/labeler.yml | 11 ----------- .github/pr-labeler.yml | 11 +++++++++++ .github/workflows/triage.yml | 20 ++++++++++++++------ 4 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 .github/issue-labeler.yml delete mode 100644 .github/labeler.yml create mode 100644 .github/pr-labeler.yml diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml new file mode 100644 index 000000000..0821bc8fe --- /dev/null +++ b/.github/issue-labeler.yml @@ -0,0 +1,2 @@ +needs_triage: + - '.*' diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 75adb1d02..000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,11 +0,0 @@ -needs_triage: - - '.*' - - '.*/*' - - '*' - - '*/*' - -docs: - - docs/* - -test: - - 'test/*' diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 000000000..4364b3239 --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,11 @@ +needs_triage: + - '.*' + - '.*/*' + - '*' + - '*/*' + +docs: + - docs/* + +test: + - 'test/*' diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 9378b4029..edc88c4ca 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -1,10 +1,5 @@ name: Triage -permissions: - contents: read - pull-requests: write - issues: write - on: issues: types: @@ -19,7 +14,20 @@ jobs: name: Label steps: - - name: Apply labels + - name: Label pull requests uses: actions/labeler@v3 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" + configuration-path: .github/pr-labeler.yml + if: github.event_name == 'pull_request_target' + + - name: Label issues + # This is the latest commit in the v2.4 branch. Waiting for a 2.4.1 or newer release. + # https://github.com/github/issue-labeler/issues/24 + uses: github/issue-labeler@99b4c5dda477c65f4ef08486b73c5787e1e33601 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + not-before: 2021-12-07T07:00:00Z + configuration-path: .github/issue-labeler.yml + enable-versioned-regex: 0 + if: github.event_name == 'issues'