Skip to content

chore: sync develop into main (docs + release governance updates) #15

chore: sync develop into main (docs + release governance updates)

chore: sync develop into main (docs + release governance updates) #15

name: Enforce main PR template (release or hotfix)
on:
pull_request_target:
types: [opened, edited, synchronize, reopened]
permissions:
pull-requests: read
jobs:
enforce-template:
if: github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
steps:
- name: Validate PR body contains Release or Hotfix template headings
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const body = (pr.body || "").toLowerCase();
// Accept either template by requiring distinctive headings.
const isRelease =
body.includes("# release pull request") ||
body.includes("## deployment readiness checklist") ||
body.includes("## post-deploy verification");
const isHotfix =
body.includes("# hotfix pull request") ||
body.includes("## rollback plan") ||
body.includes("## post-deploy verification");
if (!isRelease && !isHotfix) {
core.setFailed(
"PRs targeting 'main' must use either the Release or Hotfix PR template.\n" +
"Fix: Edit the PR description and apply the appropriate template headings.\n" +
"Expected to find either:\n" +
"- '# Release Pull Request' (and related sections), OR\n" +
"- '# Hotfix Pull Request' (and related sections)."
);
} else {
// Additional release governance requirement for release PRs.
if (isRelease) {
const managerExecuted =
body.includes("- [x] release-and-changelog-management executed");
const docsManagerExecuted =
body.includes("- [x] release-public-docs-management executed");
const artifactRefsPresent =
body.includes("public-releases/") || body.includes("releases/tag/");
if (!managerExecuted || !docsManagerExecuted || !artifactRefsPresent) {
core.setFailed(
"Release PRs targeting 'main' must confirm both management stages and artifact references.\n" +
"Fixes required:\n" +
"- Check '- [x] release-and-changelog-management executed'\n" +
"- Check '- [x] release-public-docs-management executed'\n" +
"- Include artifact references (e.g. 'public-releases/...') in PR body"
);
return;
}
}
core.info("Main-branch PR template check passed.");
}