move label checker into same pipeline (#2597)

This commit is contained in:
DaneEvans 2025-08-01 10:58:22 +10:00 committed by GitHub
parent 99b4baf9a1
commit 446cf81bd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 39 deletions

View file

@ -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(', ')}.`);
}

View file

@ -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

View file

@ -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(', ')}.`);
}