Repository navigation
chore(governance): add AGENTS.md, PrGovernance workflows, and community baseline #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| ## AI assistance | ||
|
|
||
| Which AI tool and model were used? Write `None` if no AI was used. | ||
|
|
||
| ## What changed | ||
|
|
||
| Describe the change and its purpose. | ||
|
|
||
| ## How verified | ||
|
|
||
| List the checks run and their results. Explain any checks that could not run. | ||
|
|
||
| ## Why | ||
|
|
||
| <!-- Explain the problem this change resolves. --> | ||
|
|
||
| ## Risk | ||
|
|
||
| <!-- Record the risk tier, affected paths and relevant compatibility or operational impact. --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "version": "pr-governance/v3", | ||
| "mode": "enforce", | ||
| "review_routing": { | ||
| "dispatch_mentions": [ | ||
| "@codex review", | ||
| "@claude review" | ||
| ] | ||
| }, | ||
| "r0_paths": [ | ||
| "README.md", | ||
| "CHANGELOG.md", | ||
| "docs/prose/" | ||
| ], | ||
| "r2_paths": [ | ||
| "scripts/", | ||
| ".github/governance/", | ||
| ".github/scripts/", | ||
| "src/" | ||
| ], | ||
| "dependabot_template_exemption": true, | ||
| "max_evidence_age_hours": 168 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Review request | ||
|
|
||
| # Copy to .github/workflows/codex-nudge.yml and replace Pigbibi/PrGovernance. | ||
| # Nudges Codex then Claude (see policy.review_routing). Cursor Bugbot must be | ||
| # triggered by a human (`cursor review` / `bugbot run`); bot-posted triggers are ignored. | ||
| # Optional org var GOVERNANCE_REVIEWERS_JSON overrides reviewer identities. | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '15 2,14 * * *' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| # createComment on a pull request needs pull-requests:write; issues:write | ||
| # alone returns 403 Resource not accessible by integration. | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: review-request | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| nudge: | ||
| name: Request a review | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Request | ||
| uses: Pigbibi/PrGovernance/pr-governance@7fe2ee20a3ee144ea944619e1c56f7ed5edc9152 | ||
| env: | ||
| GOVERNANCE_REVIEWERS_JSON: ${{ vars.GOVERNANCE_REVIEWERS_JSON }} | ||
| GOVERNANCE_DISPATCH_MENTIONS_JSON: ${{ vars.GOVERNANCE_DISPATCH_MENTIONS_JSON }} | ||
| with: | ||
| mode: nudge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Documentation check | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: docs-check-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| policy: | ||
| uses: QuantStrategyLab/.github/.github/workflows/docs-acceptance.yml@b4966bdd8780cad3ae5154ae50d8b98259a16dc6 | ||
| with: | ||
| policy-revision: b4966bdd8780cad3ae5154ae50d8b98259a16dc6 | ||
| mode: advisory | ||
|
|
||
| docs: | ||
| name: Documentation check | ||
| needs: policy | ||
| if: always() | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Require documentation policy acceptance | ||
| run: test "${{ needs.policy.result }}" = "success" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: Shared Gitleaks scan | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| full-history: | ||
| description: Scan all fetched branches and their complete history | ||
| type: boolean | ||
| required: false | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Gitleaks | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Check out the caller with full history | ||
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| path: source | ||
| - name: Check out trusted scanner and shared configuration | ||
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | ||
| with: | ||
| repository: QuantStrategyLab/.github | ||
| # Pin the helper commit; changes to helpers require an explicit pin update. | ||
| ref: 0da4da68433b803cda17d3f84e29875a94a32273 | ||
| persist-credentials: false | ||
| path: secret-scan-tools | ||
| - name: Install checksum-verified Gitleaks | ||
| run: bash secret-scan-tools/scripts/install-gitleaks.sh "$RUNNER_TEMP/shared-gitleaks" | ||
| - name: Fetch every branch, including logs and state | ||
| if: inputs.full-history | ||
| working-directory: source | ||
| run: git fetch origin '+refs/heads/*:refs/remotes/origin/*' | ||
| - name: Scan with shared rules and redacted output | ||
| id: scan | ||
| shell: bash | ||
| env: | ||
| FULL_HISTORY: ${{ inputs.full-history }} | ||
| PR_BASE: ${{ github.event.pull_request.base.sha }} | ||
| PR_HEAD: ${{ github.event.pull_request.head.sha }} | ||
| PUSH_BASE: ${{ github.event.before }} | ||
| PUSH_HEAD: ${{ github.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
| log_opts=--all | ||
| if [[ "$FULL_HISTORY" != true ]]; then | ||
| base="${PR_BASE:-$PUSH_BASE}" | ||
| head="${PR_HEAD:-$PUSH_HEAD}" | ||
| if [[ -z "$base" || "$base" =~ ^0+$ || -z "$head" ]]; then | ||
| echo 'Missing comparison commits; refusing an incomplete scan' >&2 | ||
| exit 2 | ||
| fi | ||
| log_opts="$base..$head" | ||
| fi | ||
| python3 secret-scan-tools/scripts/scan-secrets.py git source \ | ||
| --gitleaks "$RUNNER_TEMP/shared-gitleaks/gitleaks" \ | ||
| --log-opts="$log_opts" \ | ||
| --summary "$RUNNER_TEMP/gitleaks-summary/summary.json" | ||
| - name: Upload only the path and rule summary | ||
| if: ${{ !cancelled() && inputs.full-history && steps.scan.outcome != 'skipped' }} | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | ||
| with: | ||
| name: gitleaks-history-summary-${{ github.run_id }}-${{ github.run_attempt }} | ||
| path: ${{ runner.temp }}/gitleaks-summary/summary.json | ||
| if-no-files-found: error | ||
| retention-days: 3 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: PR review signal | ||
|
|
||
| # Copy to .github/workflows/pr-review-signal.yml and replace nothing: this | ||
| # workflow holds no permissions and runs no repository code. It exists because a | ||
| # review event on a fork or Dependabot pull request gets a read-only token, so | ||
| # the gate that publishes statuses has to be started by `workflow_run` instead. | ||
| # Keep the workflow name; risk-gate.yml refers to it. | ||
|
|
||
| on: | ||
| pull_request_review: | ||
| types: [submitted, edited, dismissed] | ||
| pull_request_review_comment: | ||
| types: [created, edited, deleted] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| signal: | ||
| name: Signal review change | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 2 | ||
| steps: | ||
| - name: Signal | ||
| run: echo "review event recorded" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: PR risk gate | ||
|
|
||
| # Copy to .github/workflows/risk-gate.yml and replace Pigbibi/PrGovernance with | ||
| # the owner's governance repository (for example Pigbibi/PrGovernance). | ||
| # The job names in this file are the required status check contexts; keep them. | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened, synchronize, edited, labeled, unlabeled, ready_for_review, closed] | ||
| issue_comment: | ||
| types: [created, edited, deleted] | ||
| # A review or inline comment on a fork or Dependabot pull request gets a | ||
| # read-only token, so those events are relayed through the permissionless | ||
| # `PR review signal` workflow and evaluated by this trusted run. | ||
| workflow_run: | ||
| workflows: ["PR review signal"] | ||
| types: [completed] | ||
| push: | ||
| branches: [main, master] | ||
| # A merge made with GITHUB_TOKEN raises no push, and nothing raises an event | ||
| # for a resolved review thread, so a sweep closes both gaps. | ||
| schedule: | ||
| - cron: '17 3 * * *' | ||
| workflow_dispatch: | ||
| inputs: | ||
| pr_number: | ||
| description: Existing pull request number to evaluate | ||
| required: true | ||
| type: string | ||
|
|
||
| # The gate reads metadata only. It never checks out or runs pull request code. | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| statuses: write | ||
| actions: write | ||
|
|
||
| jobs: | ||
| # The labeled payload is the only authenticated record of which head a | ||
| # clearing label was added to. Recording it in its own job keeps the evidence | ||
| # independent of an evaluation that a later event may supersede. | ||
| record_label: | ||
| name: Record the head a clearing label was added to | ||
| if: github.event_name == 'pull_request_target' && github.event.action == 'labeled' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| issues: read | ||
| pull-requests: read | ||
| statuses: write | ||
| steps: | ||
| - name: Record label head | ||
| uses: Pigbibi/PrGovernance/pr-governance@7fe2ee20a3ee144ea944619e1c56f7ed5edc9152 | ||
| env: | ||
| GOVERNANCE_OWNER_ID: ${{ vars.RISK_GATE_OWNER_ID }} | ||
| GOVERNANCE_OWNER_LOGIN: ${{ vars.RISK_GATE_OWNER }} | ||
| with: | ||
| mode: gate | ||
| record-label: 'true' | ||
|
|
||
| evaluate: | ||
| name: Evaluate PR governance | ||
| needs: record_label | ||
| # A skipped recorder is the normal case for every other event. | ||
| if: >- | ||
| always() && needs.record_label.result != 'cancelled' && | ||
| (github.event_name != 'issue_comment' || | ||
| (github.event.issue.pull_request && | ||
| (github.event.comment.user.type == 'Bot' || | ||
| contains(github.event.comment.body || '', 'codex-review') || | ||
| contains(github.event.comment.body || '', 'ai-review-receipt')))) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| statuses: write | ||
| actions: write | ||
| # Job-level, so an irrelevant comment skips the job without cancelling an | ||
| # evaluation already running. Label evidence no longer rides on this run. | ||
| concurrency: | ||
| group: pr-governance-${{ github.event.pull_request.number || github.event.issue.number || github.event.workflow_run.pull_requests[0].number || inputs.pr_number || github.run_id }} | ||
| cancel-in-progress: true | ||
| steps: | ||
| - name: Evaluate | ||
| uses: Pigbibi/PrGovernance/pr-governance@7fe2ee20a3ee144ea944619e1c56f7ed5edc9152 | ||
| env: | ||
| GOVERNANCE_OWNER_ID: ${{ vars.RISK_GATE_OWNER_ID }} | ||
| GOVERNANCE_OWNER_LOGIN: ${{ vars.RISK_GATE_OWNER }} | ||
| # Optional: a repository that keeps account identifiers out of public | ||
| # source configures the reviewer here instead of in policy.json. | ||
| GOVERNANCE_REVIEWER_APP_ID: ${{ vars.RISK_GATE_REVIEWER_APP_ID }} | ||
| GOVERNANCE_REVIEWER_USER_ID: ${{ vars.RISK_GATE_REVIEWER_USER_ID }} | ||
| GOVERNANCE_REVIEWER_LOGIN: ${{ vars.RISK_GATE_REVIEWER_LOGIN }} | ||
| GOVERNANCE_REVIEWERS_JSON: ${{ vars.GOVERNANCE_REVIEWERS_JSON }} | ||
| with: | ||
| mode: gate | ||
| record-label: 'false' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| __pycache__/ | ||
| *.pyc | ||
| .pytest_cache/ | ||
| .ruff_cache/ | ||
| .DS_Store | ||
|
|
||
| # AI assistant / agent local state | ||
| .claude/ | ||
| .codex/ | ||
| .cursor/ | ||
| .cursorrules | ||
| .worktrees/ | ||
| worktrees/ | ||
|
|
||
| # Keep AI rule entrypoints tracked even when global gitignore excludes Markdown | ||
| !AGENTS.md | ||
| !CLAUDE.md | ||
|
|
||
| # Local working notes & internal process records (never commit) | ||
| .local/ | ||
| ops-notes/ | ||
| *.local.md | ||
| *.internal.md | ||
| *[Aa][Uu][Dd][Ii][Tt]*.md | ||
| *[Hh][Aa][Nn][Dd][Oo][Ff][Ff]*.md | ||
| *-[Rr][Ee][Vv][Ii][Ee][Ww]-*.md | ||
| *_[Rr][Ee][Vv][Ii][Ee][Ww]_*.md | ||
| docs/audits/ | ||
| docs/plans/ | ||
| docs/handoffs/ | ||
| docs/superpowers/ | ||
| docs/changes/ | ||
| docs/acceptance-policy.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| repos: | ||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: 83d9cd684c87d95d656c1458ef04895a7f1cbd8e # v8.30.1 | ||
| hooks: | ||
| - id: gitleaks | ||
| args: [--redact] | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.11.0 | ||
| hooks: | ||
| - id: ruff | ||
| args: [--fix] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new scanner only accepts
workflow_call, but a repository-wide search of the tracked workflows found no caller forgitleaks.yml. Consequently, neither pull requests nor pushes run this scan, so the secret-scanning baseline introduced by this commit does not protect repository changes. Add a caller triggered by pull requests and pushes, or add those events directly to this workflow; the optional local pre-commit hook does not provide CI coverage.Useful? React with 👍 / 👎.