diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..dfecbaa --- /dev/null +++ b/.github/README.md @@ -0,0 +1,15 @@ +# Main branch policy + +- All changes to `main` must go through a pull request, including the owner's changes. +- Only @viralcodex can merge. Direct pushes, force pushes, and branch deletion are blocked. +- PRs authored by @viralcodex need no reviews. +- Other PRs require @viralcodex to approve the current head commit. New commits, dismissed approvals, and requested changes block merging. +- The `Owner approval` status is mandatory and has no ruleset bypass. + +The privileged approval workflow uses code from `main`, never contributor code. A permissionless review-event workflow wakes it after reviews. A scheduled reconciliation also handles reviews if a fork's event workflow cannot run. GitHub may delay scheduled runs. To refresh immediately, run **Enforce owner approval** from the Actions tab or post a PR comment. + +Commit statuses are shared across PRs with the same head commit. All such open PRs must satisfy the policy to prevent one PR from bypassing another's approval requirement. + +Accept untrusted contributions from forks without granting repository write access. This policy trusts the GitHub Actions app to publish the approval status. Repository writers can author Actions workflows and must be trusted. + +Run the policy tests with `node --test .github/scripts/owner-approval.test.cjs`. diff --git a/.github/workflows/owner-approval.yml b/.github/workflows/owner-approval.yml index 4f77d95..dc7c475 100644 --- a/.github/workflows/owner-approval.yml +++ b/.github/workflows/owner-approval.yml @@ -31,11 +31,11 @@ jobs: timeout-minutes: 5 steps: # Always use trusted main, never a PR's code or merge commit. - - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 with: ref: refs/heads/main persist-credentials: false - - uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 + - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 with: script: | const { reconcile } = require('./.github/scripts/owner-approval.cjs')