Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 51 additions & 12 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
types:
- checks_requested

concurrency:
group: pr-checks-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CI: true
NODE_ENV: production
Expand All @@ -22,6 +26,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v6
with:
Expand Down Expand Up @@ -69,11 +75,20 @@ jobs:
- name: Check Markdown/MDX links for disallowed characters
shell: bash
run: |
FILES="$(git ls-files '*.md' '*.mdx' 2>/dev/null || true)"
if [ -z "$FILES" ]; then
echo "No Markdown/MDX files found; skipping link check."
FILES=()
while IFS= read -r -d '' file; do
FILES+=("$file")
done < <(
git diff --name-only -z origin/main...HEAD -- docs |
grep -zE '^docs/.*\.mdx?$' || true
)
if [ "${#FILES[@]}" -eq 0 ]; then
echo "No changed Markdown/MDX docs files found; skipping link check."
exit 0
fi
echo "Checking changed docs files:"
printf '%s\n' "${FILES[@]}"

BAD_LINKS=$(
awk '
BEGIN { in_code=0 }
Expand Down Expand Up @@ -107,7 +122,7 @@ jobs:
line=substr(line, RSTART+RLENGTH)
}
}
' $FILES
' "${FILES[@]}"
)

if [ -n "$BAD_LINKS" ]; then
Expand All @@ -125,16 +140,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check spelling
uses: codespell-project/actions-codespell@v2
with:
path: docs
skip: "*.svg,*.js,*.map,*.css,*.scss"
ignore_words_list: "aks,atleast,cros,ddress,delink,fiel,ist,nd,ot,pullrequest,ser,shttp,wast,fo,seldomly,delt,cruzer,plack,secur,te,nginx,Nginx,notin"
fetch-depth: 0
- name: Check spelling on changed files
shell: bash
run: |
pip install codespell --quiet
FILES=()
while IFS= read -r -d '' file; do
FILES+=("$file")
done < <(
git diff --name-only -z origin/main...HEAD -- docs |
grep -zE '^docs/.*\.mdx?$' || true
)
if [ "${#FILES[@]}" -eq 0 ]; then
echo "No docs files changed — skipping spellcheck."
exit 0
fi
echo "Checking changed docs files:"
printf '%s\n' "${FILES[@]}"
printf '%s\0' "${FILES[@]}" | xargs -0 codespell \
--skip="*.svg,*.js,*.map,*.css,*.scss" \
--ignore-words-list="aks,atleast,cros,ddress,delink,fiel,ist,nd,ot,pullrequest,ser,shttp,wast,fo,seldomly,delt,cruzer,plack,secur,te,nginx,Nginx,notin"
check-merge-window:
name: merge window
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check merge window
uses: actions/github-script@v7
Expand Down Expand Up @@ -211,6 +241,14 @@ jobs:
return;
}

if (context.eventName === 'merge_group') {
core.setFailed(
`Merge blocked: ${siteBlockedReason}. ` +
'Merge queue validation requires the merge window: Mon–Fri, 7:00 am–2:00 pm PT, non-holidays.'
);
return;
}

// Check override label before fetching files.
const labels = context.payload.pull_request?.labels ?? [];
if (labels.some(l => l.name === OVERRIDE_LABEL)) {
Expand All @@ -219,15 +257,16 @@ jobs:
}

// Classify the PR's changed files to determine enforcement level.
// Docs and release notes (docs/, blog-*, images) → soft warning only.
// Docs, release notes, images, and CID redirects → soft warning only.
// Everything else (backend site changes) → hard block.
const ARTICLE_PATTERNS = [
/^docs\//,
/^blog-/,
/^static\/img\//,
/^cid-redirects\.json$/,
];

const { data: files } = await github.rest.pulls.listFiles({
const files = await github.paginate(github.rest.pulls.listFiles, {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
Expand Down
Loading