Skip to content

Commit

Permalink
add check-labels workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leona-ya committed Dec 4, 2024
1 parent 905426b commit 7a9d1c6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Check risk/urgency labels"
on:
pull_request_target:
types: [labeled, unlabeled]

permissions:
contents: read

jobs:
action:
name: check-risk-urgency-labels
permissions:
statuses: write
runs-on: ubuntu-latest
steps:
- name: "Check whether the PR has risk and urgency labels"
run: |
gh api /repos/flyingcircusio/fc-nixos-testing/pulls/${{ github.event.number }} | jq -e '
.labels | {
risk: (. | map(select(.name | startswith("risk:")))),
urgency: (. | map(select(.name | startswith("urgency:"))))
}
| map_values(select(. | length != 1)) | keys
| if length == 0 then
"Risk and urgency labels are set."
else error("Label(s) " + (. | join(",")) + " not correctly set")
end'
env:
GH_TOKEN: ${{ github.token }}

0 comments on commit 7a9d1c6

Please sign in to comment.