From a1673d3aca6a43500a1c469c07d65bc54edd647b Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Sun, 24 Sep 2023 18:53:08 +0100 Subject: [PATCH] ci(pr-labeler): replace TimonVS/pr-labeler-action Replace the `TimonVS/pr-labeler-action` with `release-drafter/release-drafter` as it has an [`autolabeler`][1] option that can autolabel PRs for us. This should fix labeling PRs from forks, see https://github.com/TimonVS/pr-labeler-action/issues/25. I've kept the `.github/pr-labeler.yml` configuration file, so that links to it from the https://mermaid.js.org website continue to work. I've also kept everything in the same `.github/workflows/pr-labeler.yml` GitHub Actions workflow to make the `git diff` easier to review, and to keep the GitHub Actions permissions the same. [1]: https://github.com/release-drafter/release-drafter/blob/ff929b5ceb21bf2646a216e916f9a8bb507d48a3/README.md#autolabeler --- .github/pr-labeler.yml | 32 +++++++++++-------- .../workflows/pr-labeler-config-validator.yml | 23 ------------- .github/workflows/pr-labeler.yml | 8 +++-- .github/workflows/release-draft.yml | 2 ++ 4 files changed, 27 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/pr-labeler-config-validator.yml diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml index bbd122a7ca..5613ca2bb9 100644 --- a/.github/pr-labeler.yml +++ b/.github/pr-labeler.yml @@ -1,13 +1,19 @@ -'Type: Bug / Error': - - 'bug/*' - - 'fix/*' -'Type: Enhancement': - - 'feature/*' - - 'feat/*' -'Type: Other': - - 'other/*' - - 'chore/*' - - 'test/*' - - 'refactor/*' -'Area: Documentation': - - 'docs/*' +# yaml-language-server: $schema=https://raw.githubusercontent.com/release-drafter/release-drafter/master/schema.json +autolabeler: + - label: 'Type: Bug / Error' + branch: + - '/bug\/.+/' + - '/fix\/.+/' + - label: 'Type: Enhancement' + branch: + - '/feature\/.+/' + - '/feat\/.+/' + - label: 'Type: Other' + branch: + - '/other\/.+/' + - '/chore\/.+/' + - '/test\/.+/' + - '/refactor\/.+/' + - label: 'Area: Documentation' + branch: + - '/docs\/.+/' diff --git a/.github/workflows/pr-labeler-config-validator.yml b/.github/workflows/pr-labeler-config-validator.yml deleted file mode 100644 index ff5d8d0a1f..0000000000 --- a/.github/workflows/pr-labeler-config-validator.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Validate PR Labeler Configuration -on: - push: - paths: - - .github/workflows/pr-labeler-config-validator.yml - - .github/workflows/pr-labeler.yml - - .github/pr-labeler.yml - pull_request: - paths: - - .github/workflows/pr-labeler-config-validator.yml - - .github/workflows/pr-labeler.yml - - .github/pr-labeler.yml - -jobs: - pr-labeler: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Validate Configuration - uses: Yash-Singh1/pr-labeler-config-validator@releases/v0.0.3 - with: - configuration-path: .github/pr-labeler.yml diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 52228a2273..b2fc1cc26e 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -9,7 +9,7 @@ on: # Please read the following first before reviewing/merging: # - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target # - https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ - types: [opened] + types: [opened, reopened, synchronize] permissions: contents: read @@ -22,6 +22,10 @@ jobs: pull-requests: write # write permission is required to label PRs steps: - name: Label PR - uses: TimonVS/pr-labeler-action@v4 + uses: release-drafter/release-drafter@v5 + with: + config-name: pr-labeler.yml + disable-autolabeler: false + disable-releaser: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml index c130375976..8ad1b13ecd 100644 --- a/.github/workflows/release-draft.yml +++ b/.github/workflows/release-draft.yml @@ -17,5 +17,7 @@ jobs: steps: - name: Draft Release uses: release-drafter/release-drafter@v5 + with: + disable-autolabeler: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}