From 446cf81bd0009d7b6f4d091f72e57a6bd9dc6c81 Mon Sep 17 00:00:00 2001 From: DaneEvans Date: Fri, 1 Aug 2025 10:58:22 +1000 Subject: [PATCH] move label checker into same pipeline (#2597) --- .github/workflows/pr_enforce_labels.yml | 24 ----------------------- .github/workflows/pull-request-target.yml | 15 -------------- .github/workflows/pull-request.yml | 21 ++++++++++++++++++++ 3 files changed, 21 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/pr_enforce_labels.yml delete mode 100644 .github/workflows/pull-request-target.yml diff --git a/.github/workflows/pr_enforce_labels.yml b/.github/workflows/pr_enforce_labels.yml deleted file mode 100644 index 8a4c0d00d..000000000 --- a/.github/workflows/pr_enforce_labels.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Check PR Labels - -on: - pull_request: - types: [opened, edited, labeled, unlabeled, synchronize, reopened] - -permissions: - pull-requests: read - contents: read - -jobs: - check-label: - runs-on: ubuntu-24.04 - steps: - - name: Check for PR labels - uses: actions/github-script@v7 - with: - script: | - const labels = context.payload.pull_request.labels.map(label => label.name); - const requiredLabels = ['bugfix', 'enhancement', 'automation', 'dependencies', 'repo', 'release']; - const hasRequiredLabel = labels.some(label => requiredLabels.includes(label)); - if (!hasRequiredLabel) { - core.setFailed(`PR must have at least one of the following labels before it can be merged: ${requiredLabels.join(', ')}.`); - } diff --git a/.github/workflows/pull-request-target.yml b/.github/workflows/pull-request-target.yml deleted file mode 100644 index cf0325677..000000000 --- a/.github/workflows/pull-request-target.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "Pull Request Labeler" -on: -- pull_request_target -# Do not execute arbitary code on this workflow. -# See warnings at https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request_target - -jobs: - labeler: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - id: label-the-PR - uses: actions/labeler@v5 \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 38e2322ab..76a78d0f5 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,6 +4,8 @@ on: pull_request: branches: - main + workflow_dispatch: # Allow manual triggering + concurrency: group: build-pr-${{ github.ref }} @@ -47,3 +49,22 @@ jobs: } exit_on_result "build_and_detekt" "${{ needs.build_and_detekt.result }}" exit_on_result "androidTest" "${{ needs.androidTest.result }}" + + check-label: + runs-on: ubuntu-latest + needs: + [ + check-workflow-status, + ] + steps: + - name: Check for PR labels + uses: actions/github-script@v7 + with: + script: | + const labels = context.payload.pull_request.labels.map(label => label.name); + const requiredLabels = ['bugfix', 'enhancement', 'automation', 'dependencies', 'repo', 'release']; + const hasRequiredLabel = labels.some(label => requiredLabels.includes(label)); + console.log(labels); + if (!hasRequiredLabel) { + core.setFailed(`PR must have at least one of the following labels before it can be merged: ${requiredLabels.join(', ')}.`); + }