secondsky/claude-skills / plugins/github-project-automation/skills/github-project-automation
github-project-automation
VerifiedGitHub repository automation (CI/CD, issue templates, Dependabot, CodeQL). Use for project setup, Actions workflows, security scanning, or encountering YAML syntax, workflow configuration, template structure errors.
templates/workflows/pr-checks.yml
View on GitHub# Pull Request Checks Workflow
# Runs checks on all pull requests
#
# Triggers on: pull_request
# Checks: Size, labels, commit conventions, branch naming
name: PR Checks
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
# Least privilege: only the labels check talks to the API, and it only
# needs read access; everything else just reads the repository.
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
pr-size:
name: Check PR Size
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Check PR size
# Event-derived values are passed via env, never interpolated
# directly into the script (prevents template injection).
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Get number of changed lines
CHANGES=$(git diff --shortstat "$BASE_SHA..$HEAD_SHA")
ADDED=$(echo "$CHANGES" | awk '{print $4}')
DELETED=$(echo "$CHANGES" | awk '{print $6}')
TOTAL=$((ADDED + DELETED))
echo "Lines changed: $TOTAL"
echo "Added: $ADDED"
echo "Deleted: $DELETED"
# Warn if PR is large (>800 lines)
if [ "$TOTAL" -gt 800 ]; then
echo "⚠️ Large PR detected ($TOTAL lines changed)"
echo "Consider splitting into smaller PRs for easier review"
exit 1
elif [ "$TOTAL" -gt 400 ]; then
echo "⚠️ Medium-sized PR ($TOTAL lines changed)"
echo "This is acceptable but consider splitting if possible"
else
echo "✅ PR size looks good ($TOTAL lines changed)"
fi
commit-format:
name: Check Commit Messages
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Check commit messages
# Event-derived values are passed via env, never interpolated
# directly into the script (prevents template injection).
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Check if commits follow conventional commits format
echo "Checking commit messages..."
git log --format=%s "$BASE_SHA..$HEAD_SHA" | while read -r msg; do
if ! echo "$msg" | grep -qE '^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .+'; then
echo "❌ Invalid commit message: $msg"
echo "Must follow format: type(scope): description"
echo "Example: feat(auth): add OAuth support"
exit 1
else
echo "✅ Valid: $msg"
fi
done
branch-naming:
name: Check Branch Name
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Check branch name
# SECURITY: github.head_ref is attacker-controlled on fork PRs.
# It is passed via env (never interpolated into the script) and
# always referenced quoted, so a branch name cannot inject shell
# commands into this workflow.
env:
BRANCH: ${{ github.head_ref }}
run: |
echo "Branch name: $BRANCH"
# Check if branch follows naming convention
# Allowed: feature/, fix/, docs/, refactor/, test/, chore/
if ! echo "$BRANCH" | grep -qE '^(feature|fix|docs|refactor|test|chore)/[a-z0-9-]+$'; then
echo "❌ Invalid branch name: $BRANCH"
echo "Must follow format: type/description-in-kebab-case"
echo "Examples: feature/add-oauth, fix/login-bug"
exit 1
else
echo "✅ Branch name follows conventions"
fi
required-labels:
name: Check Required Labels
runs-on: ubuntu-24.04
timeout-minutes: 10
# Read-only API access is enough to inspect PR labels.
permissions:
contents: read
pull-requests: read
steps:
- name: Check for labels
# Event-derived values are passed via env, never interpolated
# directly into the script (prevents template injection).
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
# Get PR labels
LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name' | tr '\n' ',')
echo "PR labels: $LABELS"
# Check if PR has at least one type label
if ! echo "$LABELS" | grep -qE 'bug|feature|enhancement|documentation|refactor'; then
echo "⚠️ PR is missing a type label"
echo "Add one of: bug, feature, enhancement, documentation, refactor"
exit 1
else
echo "✅ PR has required labels"
fi
conflict-check:
name: Check for Merge Conflicts
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check for conflicts
# Event-derived values are passed via env, never interpolated
# directly into the script (prevents template injection).
env:
MERGEABLE: ${{ github.event.pull_request.mergeable }}
run: |
if [ "$MERGEABLE" = "false" ]; then
echo "❌ PR has merge conflicts"
echo "Please resolve conflicts before merging"
exit 1
else
echo "✅ No merge conflicts detected"
fi
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |