feat: verify presence and relevance of PR labels #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow assigns labels to PRs based on conventional commit titles. | |
# It looks at the commits in a pull request, mapping their commit types | |
# (and some scopes) into labels according to the mappings in this workflow file. | |
# | |
# You can adjust the specific behavior by modifying this file. | |
# For more information, see: | |
# https://github.com/dupuy/action-assign-labels?tab=readme-ov-file#computer-how-to-use-action-assign-labels | |
name: 'Label management for PRs' | |
on: | |
pull_request: | |
branches: ['main'] | |
types: | |
- opened | |
- ready_for_review | |
- reopened | |
- synchronize | |
# Declare default permissions. | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
assign-labels: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 'Harden runner' | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
- name: 'Assign labels to PRs from conventional commit types' | |
uses: dupuy/action-assign-labels@b6939985ff45d0ddb5254ead207198af4f93fba5 | |
with: | |
apply-changes: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
maintain-labels-not-matched: true | |
conventional-commits: | # This is just a string only parsed by action | |
conventional-commits: | |
- type: 'fix' | |
nouns: ['fix'] | |
labels: ['bug'] | |
- type: 'feature' | |
nouns: ['feat'] | |
labels: ['enhancement'] | |
- type: 'breaking_change' | |
nouns: ['BREAKING CHANGE', 'BREAKING', 'feat!', 'fix!'] | |
labels: ['major'] | |
- type: 'build' | |
nouns: ['build', 'build(deps)', 'build(dev-deps)', 'chore'] | |
labels: ['deployment'] | |
- type: 'integration' | |
nouns: ['ci', 'test'] | |
labels: ['testing'] | |
- type: 'documentation' | |
nouns: ['docs'] | |
labels: ['documentation'] | |
- type: 'performance' | |
nouns: ['perf'] | |
labels: ['performance'] | |
- type: 'refactor' | |
nouns: ['refactor'] | |
labels: ['refactor'] | |
- type: 'style' | |
nouns: ['style'] | |
labels: ['style'] | |
verify-labels: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 'Harden runner' | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
- name: 'Verify labels in a PR' | |
id: action-verify-labels | |
uses: dupuy/action-verify-labels@16e1b6e0801717f0498e64a354bfd228ab432f8c | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
request-review-header: '🔖 **verify-labels-action**' | |
request-review: true | |
none: >- | |
duplicate, inactive, invalid, question, wontfix, | |
good first issue, help wanted | |
some: >- | |
bug, enhancement, major, | |
deployment, documentation, integration, performance, refactor, | |
style, testing, |