Enables us to auto-generate the changelog from the list of PRs for a modicum of summarizing/categorizing work on PR creation. Does not (yet) allow external contributors to set category labels by themselves as this creates issues with triggering one workflow from another, it is not clear whether they should be allowed to create new categories, and the reviewer/triage team likely is in a better position to do the categorization anyway.
24 lines
851 B
YAML
24 lines
851 B
YAML
name: Check PR body for changelog convention
|
|
|
|
on:
|
|
merge_group:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, edited, labeled]
|
|
|
|
jobs:
|
|
check-pr-body:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check PR body
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const { title, body, labels } = context.payload.pull_request;
|
|
if (/^(feat|fix):/.test(title) && !labels.some(label => label.name == "changelog-no")) {
|
|
if (!labels.some(label => label.name.startsWith("changelog-"))) {
|
|
core.setFailed('feat/fix PR must have a `changelog-*` label');
|
|
}
|
|
if (!/^This PR [^<]/.test(body)) {
|
|
core.setFailed('feat/fix PR must have changelog summary starting with "This PR ..." as first line.');
|
|
}
|
|
}
|