Skip to content

merge queue: queuing main (e148bc1) and #555 together #244

merge queue: queuing main (e148bc1) and #555 together

merge queue: queuing main (e148bc1) and #555 together #244

Workflow file for this run

name: PR Checks
on:
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
check-forbidden-files:
name: Check Forbidden Files
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Check for tracked build artifacts
run: |
ERRORS=()
if git ls-files --cached docs/ | grep -qE '\.(html|js|css)$'; then
ERRORS+=("docs/ contains tracked HTML/JS/CSS build artifacts. Run 'git rm -r --cached docs/' to fix.")
fi
if git ls-files --cached | grep -qE '^target/'; then
ERRORS+=("target/ directory contains tracked files. Run 'git rm -r --cached target/' to fix.")
fi
if git ls-files --cached | grep -qE '^\.playwright-mcp/'; then
ERRORS+=(".playwright-mcp/ contains tracked files. Run 'git rm -r --cached .playwright-mcp/' to fix.")
fi
if git ls-files --cached docs-demo/ 2>/dev/null | grep -q .; then
ERRORS+=("docs-demo/ contains tracked files. This directory should not be in the repo.")
fi
if git ls-files --cached | grep -qE '\.env$|\.env\.'; then
ERRORS+=(".env files are tracked. Remove them immediately.")
fi
if [ ${#ERRORS[@]} -gt 0 ]; then
echo "::error::Forbidden files detected in git tracking"
for err in "${ERRORS[@]}"; do
echo "::error::$err"
done
exit 1
fi
echo "No forbidden files detected"
check-pr-size:
name: Check PR Size
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Check PR size
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
PR_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body // ""')
TOTAL_LINES=$(git diff --stat origin/main...HEAD | tail -1 | awk '{print $4+$6}' | tr -d ' ')
if [ -z "$TOTAL_LINES" ]; then
echo "Could not calculate diff size, skipping check"
exit 0
fi
THRESHOLD=1000
if [ "$TOTAL_LINES" -gt "$THRESHOLD" ]; then
if echo "$PR_BODY" | grep -qi "justification\|large PR\|breaking change"; then
echo "::warning::PR has $TOTAL_LINES changed lines (threshold: $THRESHOLD). Justification found in PR description."
else
echo "::error::PR has $TOTAL_LINES changed lines, exceeding the $THRESHOLD line threshold. Add a 'Justification' or 'Large PR' section to the PR description."
exit 1
fi
else
echo "PR size OK: $TOTAL_LINES changed lines (threshold: $THRESHOLD)"
fi
check-branch-staleness:
name: Check Branch Staleness
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Check branch age
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
PR_CREATED="${{ github.event.pull_request.created_at }}"
PR_UPDATED="${{ github.event.pull_request.updated_at }}"
BRANCH_DATE=$(date -d "$PR_CREATED" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%SZ" "$PR_CREATED" +%s 2>/dev/null)
NOW=$(date +%s)
AGE_DAYS=$(( (NOW - BRANCH_DATE) / 86400 ))
THRESHOLD_DAYS=30
if [ "$AGE_DAYS" -gt "$THRESHOLD_DAYS" ]; then
echo "::warning::PR branch is $AGE_DAYS days old (threshold: $THRESHOLD_DAYS). Consider rebasing on main to avoid merge conflicts and destructive diffs."
else
echo "Branch age OK: $AGE_DAYS days old"
fi