Close Wrong Team by Directory
Close PRs to a specified directory if the PR author is not on an approved team.
Conditions (all must be true):
- The PR changes one or more files inside
/src/views
. Customize this value for your project. - The PR author is not a member of the
ui
team. Customize this value for your organization.
Automation Actions:
- Close the PR.
- Post a comment that explains why the PR was closed.
Close Wrong Team by Directory
# -*- mode: yaml -*-
manifest:
version: 1.0
automations:
# Close PRs to restricted sections of the codebase if the PR author isn't on the correct team.
close_wrong_team_by_directory:
# Triggered when someone who isn't on the `ui` team submits a PR to change files inside /src/views
if:
- {{ files | match(regex=r/src\/views/) | some }}
- {{ pr.author_teams | match(term='ui') | nope }}
# Close the PR and post a comment explaining the next step.
run:
- action: add-comment@v1
args:
comment: Please contact a member of the `ui` team if you need to make changes to files in `src/views`
- action: close@v1