Repository navigation
chore: finalize CODEOWNERS standard as Required + add enforcement #193
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 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9736963
chore: finalize CODEOWNERS standard and add enforcement
don-petry 087d0be
refine: org-leads must be FIRST owner; allow other teams; forbid indi…
don-petry 4ab2805
Merge branch 'main' into chore/codeowners-standard-enforcement
github-actions[bot] 0eec8b4
Merge branch 'main' into chore/codeowners-standard-enforcement
github-actions[bot] d9373b9
fix(audit): warn when CODEOWNERS lacks a catch-all * pattern
don-petry 1d63387
fix(audit): guard individual-owner pipeline against pipefail exit
don-petry e7131e8
Merge branch 'main' into chore/codeowners-standard-enforcement
github-actions[bot] 54dc1a0
Merge branch 'main' into chore/codeowners-standard-enforcement
github-actions[bot] 42d6333
ci: trigger CI on auto-rebase commit
don-petry b94692e
Merge branch 'main' into chore/codeowners-standard-enforcement
github-actions[bot] 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
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 |
|---|---|---|
| @@ -1,42 +1,100 @@ | ||
| # CODEOWNERS Standard | ||
|
|
||
| **Status:** Active | ||
| **Status:** Required | ||
| **Applies to:** All repos in `petry-projects` org | ||
| **Enforced by:** [`compliance-audit.sh`](../scripts/compliance-audit.sh) (`check_codeowners`) | ||
| **Migration completed:** 2026-05-04 | ||
|
|
||
| ## Rule | ||
|
|
||
| CODEOWNERS files MUST reference the `@petry-projects/org-leads` team rather than individual users or bot accounts. | ||
| CODEOWNERS files MUST reference the `@petry-projects/org-leads` team rather | ||
| than individual users or bot accounts. The default `*` pattern MUST list | ||
| exactly `@petry-projects/org-leads` and no individuals. | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| ```text | ||
| # Default | ||
| * @petry-projects/org-leads | ||
| ``` | ||
|
|
||
| Path-specific rules MAY use additional teams or individuals when a narrower owner is appropriate, but the default `*` rule must always include `@petry-projects/org-leads`. | ||
| Path-specific rules MAY use additional teams or individuals when a narrower | ||
| owner is appropriate, but every owner line MUST include | ||
| `@petry-projects/org-leads` (so the team can always satisfy | ||
| `require_code_owner_review`). | ||
|
don-petry marked this conversation as resolved.
Resolved
|
||
|
|
||
| The legacy direct-listing pattern is **forbidden**: | ||
|
|
||
| ```text | ||
| # DO NOT USE | ||
| * @don-petry @petry-projects-pr-review-agent @dependabot-automerge-petry | ||
| ``` | ||
|
|
||
| ## Why | ||
|
|
||
| - **Stable CODEOWNERS files** — adding/removing an owner is a team membership change, not a multi-repo PR | ||
| - **CODEOWNERS support for automation** — GitHub Apps cannot be listed in CODEOWNERS | ||
| (platform limitation), but a machine user in the team can satisfy | ||
| `require_code_owner_review`. See [pr-review-agent issue #27](https://github.com/don-petry/pr-review-agent/issues/27) | ||
| - **Centralized control** — team membership is managed in one place via the org admin UI | ||
| - **Stable CODEOWNERS files** — adding/removing an owner is a team membership | ||
| change, not a multi-repo PR | ||
| - **CODEOWNERS support for automation** — GitHub Apps **cannot** be listed in | ||
| CODEOWNERS (platform limitation, | ||
| [community discussion #23064](https://github.com/orgs/community/discussions/23064)). | ||
| A machine user in the team **can** satisfy `require_code_owner_review`. See | ||
| [pr-review-agent issue #27](https://github.com/don-petry/pr-review-agent/issues/27) | ||
| - **Centralized control** — team membership is managed in one place via the | ||
| org admin UI; no PR churn when membership changes | ||
|
|
||
| ## Team Composition | ||
|
|
||
| The `@petry-projects/org-leads` team contains: | ||
| The [`@petry-projects/org-leads`](https://github.com/orgs/petry-projects/teams/org-leads) | ||
| team contains: | ||
|
|
||
| - `@don-petry` — primary maintainer (team maintainer) | ||
| - `@donpetry-bot` — automation machine user (used by pr-review-agent and similar tooling) | ||
| - `@donpetry-bot` — automation machine user (used by pr-review-agent and | ||
| similar tooling) | ||
|
|
||
| Add additional human maintainers as needed. Bots/apps that need code-owner | ||
| standing MUST be machine-user accounts added to this team, not GitHub Apps. | ||
|
|
||
| ## Required Setup for New Bots | ||
|
|
||
| Add additional human maintainers as needed. Bots/apps that need code owner standing should be machine user accounts added to this team, not GitHub Apps. | ||
| When adding a new bot/automation account to the team: | ||
|
|
||
| 1. Create a GitHub user account (machine user) — not a GitHub App | ||
| 2. Add the account to the `@petry-projects/org-leads` team | ||
| 3. Generate a **fine-grained PAT** with **Resource owner = `petry-projects`** | ||
| - Resource owner MUST be the org. A PAT scoped to the bot's personal | ||
| namespace will show "no access to any repositories" even if the bot is | ||
| in the org. | ||
| - Required permissions: Contents (read), Pull requests (read+write), | ||
| Commit statuses (read), Checks (read), Metadata (read), Members (read) | ||
| 4. If the org has a fine-grained PAT approval policy, an org admin must | ||
| approve the request at | ||
| [Settings → Personal access tokens](https://github.com/organizations/petry-projects/settings/personal-access-token-requests) | ||
| 5. Store the PAT as a repo or org secret for use by GitHub Actions | ||
|
|
||
| ## Branch Protection | ||
|
|
||
| Repos that require code owner review must set `require_code_owner_review: true` on protected branches. Approvals from any member of `@petry-projects/org-leads` will satisfy the requirement. | ||
| Repos that require code owner review must set `require_code_owner_review: true` | ||
| on protected branches. Approvals from any member of `@petry-projects/org-leads` | ||
| will satisfy the requirement. | ||
|
|
||
| > **CODEOWNERS approval timing:** GitHub does not retroactively re-evaluate | ||
| > existing reviews if CODEOWNERS changes. After a CODEOWNERS edit, the next | ||
| > approval (or a re-request) is what counts. | ||
|
|
||
| ## Verified End-to-End | ||
|
|
||
| The standard was validated on 2026-05-04 against | ||
| [TalkTerm#159](https://github.com/petry-projects/TalkTerm/pull/159) — a PR | ||
| in a repo with `require_code_owner_review: true`. After: | ||
|
|
||
| 1. Migrating CODEOWNERS to `* @petry-projects/org-leads` | ||
| 2. Issuing the bot a `petry-projects`-scoped fine-grained PAT | ||
| 3. Adding `@donpetry-bot` to the team | ||
|
|
||
| ## Migration | ||
| `pr-review-agent` posted an approval that flipped `reviewDecision` from | ||
| `REVIEW_REQUIRED` to `APPROVED`, confirming code-owner satisfaction via | ||
| team membership. | ||
|
|
||
| Repos still using individual owner lists should migrate via PR replacing the legacy `* @don-petry @petry-projects-pr-review-agent @dependabot-automerge-petry` line with `* @petry-projects/org-leads`. | ||
| ## Migration History | ||
|
|
||
| The `petry-projects-pr-review-agent` GitHub App reference is non-functional (GitHub Apps cannot be CODEOWNERS) and should be removed during migration. | ||
| | Date | Change | | ||
| |------|--------| | ||
| | 2026-05-04 | Initial team-based standard adopted; all 6 child repos migrated (ContentTwin#128, TalkTerm#160, broodly#172, google-app-scripts#252, markets#153, bmad-bgreat-suite#133) | | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.