Skip to content

docs: add instruction-quality pre-commit gate #196

docs: add instruction-quality pre-commit gate

docs: add instruction-quality pre-commit gate #196

Workflow file for this run

name: PR Check
on:
pull_request:
types: [opened, edited, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
validate-pr:
name: Validate PR
runs-on: ubuntu-latest
steps:
- name: Check PR title format
uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
docs
style
refactor
perf
test
build
ci
chore
revert
deps
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
should start with a lowercase letter.
- name: Check branch naming
env:
BRANCH_NAME: ${{ github.head_ref }}
run: |
set -eo pipefail
if [[ -z "$BRANCH_NAME" ]]; then
echo "::error::BRANCH_NAME environment variable is not set"
exit 1
fi
# Allow automated tool branches (dependabot, claude, renovate, etc.)
AUTOMATED_PATTERN="^(dependabot|renovate|add-claude-|claude-)"
if [[ "$BRANCH_NAME" =~ $AUTOMATED_PATTERN ]]; then
echo "✅ Branch '$BRANCH_NAME' is from an automated tool - skipping naming check"
exit 0
fi
VALID_PATTERN="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|hotfix|release)/"
if [[ ! "$BRANCH_NAME" =~ $VALID_PATTERN ]]; then
echo "::error::Branch name '$BRANCH_NAME' does not follow naming convention."
echo ""
echo "Branch names must start with one of:"
echo " feat/ - New features"
echo " fix/ - Bug fixes"
echo " docs/ - Documentation changes"
echo " style/ - Code style changes"
echo " refactor/- Code refactoring"
echo " perf/ - Performance improvements"
echo " test/ - Test additions/changes"
echo " build/ - Build system changes"
echo " ci/ - CI configuration"
echo " chore/ - Maintenance tasks"
echo " hotfix/ - Urgent fixes"
echo " release/ - Release branches"
echo ""
echo "Example: feat/add-new-check"
exit 1
fi
echo "✅ Branch name '$BRANCH_NAME' follows naming convention"
scan-readiness:
name: Scan Agent Readiness
needs: validate-pr
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run agent-ready check
run: |
set -eo pipefail
npm run dev -- check . --json