Skip to content

Commit

Permalink
fix(github-bot): require most rules to activate when base == master (
Browse files Browse the repository at this point in the history
…#3592)

Co-authored-by: Antoine Eddi <5222525+aeddi@users.noreply.github.com>
  • Loading branch information
thehowl and aeddi authored Feb 4, 2025
1 parent 479b314 commit 3614b60
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions contribs/github-bot/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ func Config(gh *client.GitHub) ([]AutomaticCheck, []ManualCheck) {
auto := []AutomaticCheck{
{
Description: "Maintainers must be able to edit this pull request ([more info](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork))",
If: c.CreatedFromFork(),
Then: r.MaintainerCanModify(),
If: c.And(
c.BaseBranch("^master$"),
c.CreatedFromFork(),
),
Then: r.MaintainerCanModify(),
},
{
Description: "Changes to 'docs' folder must be reviewed/authored by at least one devrel and one tech-staff",
If: c.FileChanged(gh, "^docs/"),
If: c.And(
c.BaseBranch("^master$"),
c.FileChanged(gh, "^docs/"),
),
Then: r.And(
r.Or(
r.AuthorInTeam(gh, "tech-staff"),
Expand All @@ -57,7 +63,10 @@ func Config(gh *client.GitHub) ([]AutomaticCheck, []ManualCheck) {
},
{
Description: "Pending initial approval by a review team member, or review from tech-staff",
If: c.Not(c.AuthorInTeam(gh, "tech-staff")),
If: c.And(
c.BaseBranch("^master$"),
c.Not(c.AuthorInTeam(gh, "tech-staff")),
),
Then: r.
If(r.Or(
r.ReviewByOrgMembers(gh).WithDesiredState(utils.ReviewStateApproved),
Expand Down Expand Up @@ -91,7 +100,7 @@ func Config(gh *client.GitHub) ([]AutomaticCheck, []ManualCheck) {
{
Description: "Determine if infra needs to be updated before merging",
If: c.And(
c.BaseBranch("master"),
c.BaseBranch("^master$"),
c.Or(
c.FileChanged(gh, `Dockerfile`),
c.FileChanged(gh, `^misc/deployments`),
Expand Down

0 comments on commit 3614b60

Please sign in to comment.