Skip to content
Merged
Show file tree
Hide file tree
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
104 changes: 37 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: ci

on:
pull_request:
push:
branches: [main]
# `edited` re-runs the PR-body lint when the body changes.
types: [opened, edited, reopened, synchronize, ready_for_review]
workflow_dispatch:

permissions:
Expand All @@ -14,16 +14,36 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
validate-skills:
# One job, named for the required ruleset check: one VM boot and one checkout.
ci-ok:
runs-on: ubuntu-24.04
timeout-minutes: 10
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '24'
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: false
- name: PR body follows the pr skill
if: github.event_name == 'pull_request' && github.event.pull_request.user.type != 'Bot'
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
# Run the validator embedded in the canonical template, so it has one source.
python3 - <<'PY'
import os, re, subprocess, sys, textwrap

text = open("skills/pr/templates/pr-body.yml").read()
match = re.search(r"python3 - <<'PY'\n(.*?)\n\s*PY\n", text, re.DOTALL)
if not match:
sys.exit("::error::validator heredoc not found in skills/pr/templates/pr-body.yml")
sys.exit(subprocess.run([sys.executable, "-c", textwrap.dedent(match.group(1))], env=os.environ).returncode)
PY
- name: Validate skills, manifests and size budget
run: python3 scripts/validate_skills.py
- name: skills CLI discovers every skill
Expand Down Expand Up @@ -51,25 +71,21 @@ jobs:
sys.exit(1)
print(f"skills CLI lists all {len(want)} skills")
PY

privacy-and-secrets:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install pinned gitleaks
- name: Install pinned gitleaks and actionlint
run: |
set -euo pipefail
archive="$RUNNER_TEMP/gitleaks.tar.gz"
curl --fail --silent --show-error --location \
https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz \
--output "$archive"
printf '551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb %s\n' "$archive" | sha256sum --check
mkdir -p "$RUNNER_TEMP/bin"
tar -xzf "$archive" -C "$RUNNER_TEMP/bin" gitleaks
fetch() {
# fetch <url> <sha256> <binary>
archive="$RUNNER_TEMP/$3.tar.gz"
curl --fail --silent --show-error --location "$1" --output "$archive"
printf '%s %s\n' "$2" "$archive" | sha256sum --check
tar -xzf "$archive" -C "$RUNNER_TEMP/bin" "$3"
}
fetch https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz \
551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb gitleaks
fetch https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz \
8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 actionlint
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: gitleaks (all history)
run: gitleaks git --no-banner --redact --verbose .
Expand All @@ -83,31 +99,7 @@ jobs:
else
python3 scripts/check_privacy.py --all
fi

lint-and-test:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3
with:
tool: shellcheck@0.11.0
- name: Install pinned actionlint
run: |
set -euo pipefail
archive="$RUNNER_TEMP/actionlint.tar.gz"
curl --fail --silent --show-error --location \
https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz \
--output "$archive"
printf '8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 %s\n' "$archive" | sha256sum --check
mkdir -p "$RUNNER_TEMP/bin"
tar -xzf "$archive" -C "$RUNNER_TEMP/bin" actionlint
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: false
# shellcheck is pre-installed on ubuntu-24.04.
- name: shellcheck
run: shellcheck install.sh skills/omarchy-dev/scripts/omarchy-vm
- name: actionlint
Expand All @@ -116,25 +108,3 @@ jobs:
run: uvx ruff@0.17.3 check --isolated scripts tests
- name: pytest
run: uv run --no-project --with pytest==9.0.1 --with pyyaml==6.0.3 pytest -q tests/

ci-ok:
if: always()
needs: [validate-skills, privacy-and-secrets, lint-and-test]
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
- name: Every required job succeeded
env:
NEEDS: ${{ toJSON(needs) }}
run: |
python3 - <<'PY'
import json, os, sys

needs = json.loads(os.environ["NEEDS"])
bad = {name: job["result"] for name, job in needs.items() if job["result"] != "success"}
for name, result in bad.items():
print(f"::error::{name} finished with {result}")
if not needs:
print("::error::expected at least one needed job")
sys.exit(1 if bad or not needs else 0)
PY
65 changes: 0 additions & 65 deletions .github/workflows/pr-body.yml

This file was deleted.

9 changes: 4 additions & 5 deletions scripts/validate_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- relative Markdown links resolve and stay inside their own skills/<name>/,
or point into a sibling that scripts/install.py declares as a dependency;
- plugin manifests share one version;
- .github/workflows/pr-body.yml matches skills/pr/templates/pr-body.yml;
- .github/workflows/ci.yml runs the PR-body lint from skills/pr/templates/pr-body.yml;
- no CLAUDE.md at the repo root;
- every skill appears in README.md;
- description and body sizes stay within size-budget.json.
Expand Down Expand Up @@ -369,10 +369,9 @@ def validate(root: Path) -> list[str]:
if f"`{d.name}`" not in readme:
errors.append(f"README.md: skill `{d.name}` is not listed")
errors.extend(check_manifests(root))
template = root / "skills/pr/templates/pr-body.yml"
workflow = root / ".github/workflows/pr-body.yml"
if not workflow.is_file() or workflow.read_bytes() != template.read_bytes():
errors.append(".github/workflows/pr-body.yml must match skills/pr/templates/pr-body.yml byte for byte")
ci = root / ".github/workflows/ci.yml"
if not ci.is_file() or "skills/pr/templates/pr-body.yml" not in ci.read_text():
errors.append(".github/workflows/ci.yml must run the PR-body lint from skills/pr/templates/pr-body.yml")
if (root / "CLAUDE.md").exists():
errors.append("CLAUDE.md must not exist at the repo root; keep rosters in your own config")
if not errors:
Expand Down
10 changes: 6 additions & 4 deletions skills/ci-retro/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ record its labels, capacity and monthly budget in its own `AGENTS.md` or
- **Never register a self-hosted runner on a public repository.** A fork PR can
run untrusted code on it. Run public repositories on hosted runners
(`ubuntu-24.04`).
- **Match tiny, fast jobs to hosted runners** when their queue on a self-hosted
runner exceeds their run time (`pr-body`, `actionlint`). Hosted minutes are
billed per job, rounded up to a minute, so state each moved job's monthly
minutes in the PR.
- **Do not move tiny jobs to hosted runners on a private repository with a
self-hosted pool.** GitHub bills every hosted job at a 1-minute minimum, so a
3-second check (`pr-body`, `actionlint`, `ci-ok`, `lint`) costs 20x. Fold it
into an existing self-hosted job as a step, or keep the gate on self-hosted
once a job finishes. Use hosted runners on a private repository only for
secret-isolated deploys, KVM, or a low-volume repository with no pool.
- **Gate merges on one always-running aggregator job**, for example `ci-ok`,
that `needs` every CI job and fails unless each one succeeded or was skipped
by a tested scope rule. Put path filters inside the workflow, never in `on:`
Expand Down
8 changes: 8 additions & 0 deletions skills/file-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ If model identity is unavailable, name the harness without guessing a model.
Before submission, check the title, description, quotes, and attachments for
secrets and private details.

Before `gh pr create` or `pull_request_create`, check the body shape locally.
It must start at `## Summary` (with a visual), then `## Evidence` (filled
**Before:** and **After:**), then `## Merge Danger` (**Door:** and
**Blast Radius:**), in that order, with no template placeholders. CI rejects a
body that misses this. To run the exact CI check, extract the `python3`
heredoc from `skills/pr/templates/pr-body.yml` and run it with the body in
`PR_BODY`.
Comment on lines +48 to +50

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the pr skill in file-pr's installation dependencies

When users install only file-pr (including through takeover), the new local-check instructions reference a template that is not installed. scripts/install.py still resolves file-pr to only babysit-pr, file-pr, and leaving-pr-comments, while the validator lives in the separate pr skill. This leaves selective installations unable to run the prescribed CI check without finding the original checkout or manually installing another skill. Add pr to file-pr's dependency list so the referenced validator accompanies the skill.

Useful? React with 👍 / 👎.


Open a real PR rather than a draft so review bots run. If `gh pr create` fails
because the GraphQL rate limit is used up, open it through REST with
`gh api repos/<owner>/<repo>/pulls -f title=... -f head=... -f base=... -F body=@<file>`. If the user also asked
Expand Down
7 changes: 4 additions & 3 deletions tests/test_pr_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

ROOT = Path(__file__).resolve().parent.parent
TEMPLATE = ROOT / "skills" / "pr" / "templates" / "pr-body.yml"
WORKFLOW = ROOT / ".github" / "workflows" / "pr-body.yml"
CI = ROOT / ".github" / "workflows" / "ci.yml"


def extract_validator() -> str:
Expand Down Expand Up @@ -56,8 +56,9 @@ def lint(body: str) -> tuple[int, str]:
"""


def test_template_matches_workflow():
assert TEMPLATE.read_bytes() == WORKFLOW.read_bytes()
def test_ci_runs_template_validator():
assert "skills/pr/templates/pr-body.yml" in CI.read_text()
assert not (ROOT / ".github" / "workflows" / "pr-body.yml").exists()


def test_valid_body_passes():
Expand Down
8 changes: 4 additions & 4 deletions tests/test_validate_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ def test_manifests_share_version():
assert set(vs.manifest_versions(ROOT).values()) == {"0.4.0"}


def test_pr_body_workflow_must_match(repo: Path):
p = repo / ".github/workflows/pr-body.yml"
p.write_bytes(p.read_bytes() + b"\n")
assert any("byte for byte" in e for e in errors(repo))
def test_ci_must_run_pr_body_template(repo: Path):
p = repo / ".github/workflows/ci.yml"
p.write_text(p.read_text().replace("skills/pr/templates/pr-body.yml", "elsewhere.yml"))
assert any("PR-body lint" in e for e in errors(repo))


def test_root_claude_md_rejected(repo: Path):
Expand Down