965d5073c3
Implements #213: PRDs use prd-new-<slug>.md while a PR is open; a post-merge workflow on main assigns sequential numbers and renames the file. A required PR check blocks prd-new-*.md from landing on main without going through the workflow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
# Block PRs that add prd-new-*.md files directly to main.
|
|
#
|
|
# prd-new-*.md files are placeholders — they must go through a PR so
|
|
# the post-merge prd-number workflow can assign a sequential number and
|
|
# rename the file. A direct push or a PR that slips through without
|
|
# triggering the check would leave an un-numbered PRD on main.
|
|
|
|
name: prd-check
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'docs/prds/prd-new-*.md'
|
|
|
|
jobs:
|
|
no-prd-new-on-main:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Fail if prd-new-*.md files are present in the diff
|
|
run: |
|
|
base="${{ github.event.pull_request.base.sha }}"
|
|
head="${{ github.event.pull_request.head.sha }}"
|
|
new_prds=$(git diff --name-only --diff-filter=A "$base" "$head" \
|
|
| grep -E '^docs/prds/prd-new-.+\.md$' || true)
|
|
if [ -n "$new_prds" ]; then
|
|
echo "ERROR: PRs to main must not add prd-new-*.md files directly."
|
|
echo "These files must be merged via a feature branch so the"
|
|
echo "prd-number workflow can assign a sequential number on merge:"
|
|
echo "$new_prds"
|
|
exit 1
|
|
fi
|
|
echo "OK: no prd-new-*.md files added in this PR."
|