File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ name : Check playbook branches
3+ on :
4+ pull_request :
5+ paths :
6+ - local-antora-playbook.yml
7+ push :
8+ branches : [main]
9+ paths :
10+ - local-antora-playbook.yml
11+
12+ jobs :
13+ check-branches :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v4
17+
18+ - name : Check for non-standard branch references
19+ run : |
20+ # Allowed branch patterns in local-antora-playbook.yml.
21+ # Any value not matching these is likely a PR branch that
22+ # must be reverted before merge.
23+ ALLOWED='main|HEAD|v/\*|shared|site-search|!v-end-of-life/\*'
24+
25+ # Extract all branch values from the playbook
26+ BRANCHES=$(grep 'branches:' local-antora-playbook.yml \
27+ | sed 's/.*branches:[[:space:]]*//' \
28+ | tr -d "[]'" \
29+ | tr ',' '\n' \
30+ | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
31+
32+ FAILED=0
33+ while IFS= read -r branch; do
34+ [ -z "$branch" ] && continue
35+ if ! echo "$branch" | grep -qE "^(${ALLOWED})$"; then
36+ echo "::error::Non-standard branch reference found: '${branch}'"
37+ FAILED=1
38+ fi
39+ done <<< "$BRANCHES"
40+
41+ if [ "$FAILED" -eq 1 ]; then
42+ echo ""
43+ echo "local-antora-playbook.yml contains non-standard branch references."
44+ echo "These are used for cross-repo Netlify previews during PR development,"
45+ echo "but must be reverted to standard values (e.g., 'main') before merging."
46+ exit 1
47+ fi
48+
49+ echo "Playbook OK: all branch references are standard."
You can’t perform that action at this time.
0 commit comments