Skip to content

Create a CODEOWNERS-based PR approval workflow#6185

Open
jonathansick wants to merge 1 commit intomainfrom
u/jonathansick/codeowners-workflow
Open

Create a CODEOWNERS-based PR approval workflow#6185
jonathansick wants to merge 1 commit intomainfrom
u/jonathansick/codeowners-workflow

Conversation

@jonathansick
Copy link
Copy Markdown
Member

This workflow and associated codeowner_check.py script implements
CODEOWNERS-based PR checking in a way that we couldn't achieve with
GitHub's built-in branch rulesets. In short, this workflow checks if any
changed files in a PR have associated a code owners group. If they do,
and the PR creator is a member of the group, then the check is approved.
If they aren't an owner, then a review with an approval from that
group is required to get a success check. If CODEOWNERS does not exist,
or the files don't have stated owners, then a commit check is also a
success.

This workflows needs a GitHub App to provide a token with org:read,
statuses:write, and pull_request:read permissions.

@jonathansick jonathansick force-pushed the u/jonathansick/codeowners-workflow branch from d0adc41 to 4aa0b01 Compare March 5, 2026 20:20
This workflow and associated codeowner_check.py script implements
CODEOWNERS-based PR checking in a way that we couldn't achieve with
GitHub's built-in branch rulesets. In short, this workflow checks if any
changed files in a PR have associated a code owners group. If they do,
and the PR creator is a member of the group, then the check is approved.
If they aren't an owner, then a review with an approval from that
group is required to get a success check. If CODEOWNERS does not exist,
or the files don't have stated owners, then a commit check is also a
success.

This workflows needs a GitHub App to provide a token with org:read,
statuses:write, and pull_request:read permissions.
@jonathansick jonathansick force-pushed the u/jonathansick/codeowners-workflow branch from 4aa0b01 to 8cd161f Compare March 5, 2026 20:59
@frossie
Copy link
Copy Markdown
Member

frossie commented Mar 6, 2026

Great. Do you think we should test it on phalanx or something more lowkey first?

@jonathansick
Copy link
Copy Markdown
Member Author

@frossie as long as we don't make the codeowner-approval check required then it doesn't have any affect whether it passes or fails. So in a way running it in the background for a week without making it a required check for merge could be useful to validate use cases.

@jonathansick jonathansick marked this pull request as ready for review March 6, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants