mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-13 03:17:48 -04:00
labeler tweaks (#2617)
This commit is contained in:
25
.github/workflows/pr_enforce_labels.yml
vendored
Normal file
25
.github/workflows/pr_enforce_labels.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Check PR Labels
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [edited, labeled]
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-label:
|
||||
runs-on: ubuntu-latest
|
||||
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(', ')}.`);
|
||||
}
|
||||
15
.github/workflows/pull-request-target.yml
vendored
Normal file
15
.github/workflows/pull-request-target.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
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
|
||||
31
.github/workflows/pull-request.yml
vendored
31
.github/workflows/pull-request.yml
vendored
@@ -56,34 +56,3 @@ jobs:
|
||||
}
|
||||
exit_on_result "build_and_detekt" "${{ needs.build_and_detekt.result }}"
|
||||
exit_on_result "androidTest" "${{ needs.androidTest.result }}"
|
||||
|
||||
labeler:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: label-the-PR
|
||||
uses: actions/labeler@v5
|
||||
continue-on-error: true
|
||||
|
||||
check-label:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
[
|
||||
check-workflow-status,
|
||||
labeler
|
||||
]
|
||||
if: always()
|
||||
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(', ')}.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user