Skip to content

Commit

Permalink
Separate PR contributor policies (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
flanakin authored Jul 11, 2024
1 parent c5f9aab commit e74ad20
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 105 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: pulls-00-checklist
id: pulls-01-checklist
name: GitOps.PullRequestIssueManagement
description: Handles when a PR is opened with specific notes from the checklist
owner:
Expand All @@ -19,7 +19,7 @@ configuration:
then:
# spaces in markdown checkbox
- if:
- commentContains:
- bodyContains:
pattern: '^\s*- \[(\s*x\s+|\s+x\s*)\] '
isRegex: true
then:
Expand All @@ -29,7 +29,7 @@ configuration:
# spell-checker:disable
# no space in markdown checkbox
- if:
- commentContains:
- bodyContains:
pattern: '^\s*- \[\] '
isRegex: true
then:
Expand All @@ -39,13 +39,13 @@ configuration:
# spell-checker:disable
# breaking change
- if:
- commentContains:
- bodyContains:
pattern: '[x] 🚨 This is a breaking change'
then:
- addLabel:
label: 'Breaking change 🚨'
- if:
- commentContains:
- bodyContains:
pattern: '[ ] 🚨 This is a breaking change'
then:
- removeLabel:
Expand All @@ -56,13 +56,13 @@ configuration:
# spell-checker:disable
# micro PR
- if:
- commentContains:
- bodyContains:
pattern: '[x] 🤏 The change is less than 20 lines'
then:
- addLabel:
label: 'Micro PR 🔬'
- if:
- commentContains:
- bodyContains:
pattern: '[ ] 🤏 The change is less than 20 lines'
then:
- removeLabel:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
+id: pulls-00-file-paths
id: pulls-02-reviewers
name: GitOps.PullRequestIssueManagement
description: Handles when a PR is opened with specific file paths
owner:
Expand All @@ -10,100 +10,6 @@ where:
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: When a PR is reviewed, add as review contributor
if:
- or:
- payloadType: Pull_Request_Review
- payloadType: Pull_Request_Review_Comment
- or:
- isAction:
action: Submitted # for reviews
- isAction:
action: Created # for comments
- not:
targetsBranch:
branch: main
- isActivitySender:
issueAuthor: false
- not:
or:
- isActivitySender:
user: allcontributors
- isActivitySender:
user: aromano2
- isActivitySender:
user: benshy
- isActivitySender:
user: flanakin
- isActivitySender:
user: helderpinto
- isActivitySender:
user: msbrett
- isActivitySender:
user: springstone
then:
- addReply:
reply: '@all-contributors please add ${contextualAuthor} for review'
- description: When a PR is closed, add as contributor
if:
- payloadType: Pull_Request
- isAction:
action: Closed
- not:
targetsBranch:
branch: main
then:
# all code
- if:
- or:
- filesMatchPattern:
pattern: ^(.build|.github|.vscode|src\/scripts)\/.*
- filesMatchPattern:
pattern: ^src\/.*
- not:
or:
- isActivitySender:
user: aromano2
- isActivitySender:
user: arthurclares
- isActivitySender:
user: didayal-msft
- isActivitySender:
user: flanakin
- isActivitySender:
user: msbrett
- isActivitySender:
user: nteyan
- isActivitySender:
user: saadmsft
- isActivitySender:
user: sebassem
- isActivitySender:
user: springstone
then:
- addReply:
reply: '@all-contributors please add ${issueAuthor} for code'
# docs
- if:
- filesMatchPattern:
pattern: ^(docs|docs-mslearn|docs-wiki)\/.*
- not:
or:
- isActivitySender:
user: aromano2
- isActivitySender:
user: benshy
- isActivitySender:
user: flanakin
- isActivitySender:
user: helderpinto
- isActivitySender:
user: msbrett
- isActivitySender:
user: springstone
then:
- addReply:
reply: '@all-contributors please add ${issueAuthor} for doc'
- description: When a PR is opened, add labels based on file paths
if:
- payloadType: Pull_Request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: pulls-02-feedback
id: pulls-03-feedback
name: GitOps.PullRequestIssueManagement
description: Handles when a PR gets feedback
owner:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: pulls-03-respond
id: pulls-04-respond
name: GitOps.PullRequestIssueManagement
description: Handles when PR feedback is responded to
owner:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: pulls-04-approve
id: pulls-05-approve
name: GitOps.PullRequestIssueManagement
description: Handles when PR is approved
owner:
Expand Down
108 changes: 108 additions & 0 deletions .github/policies/pulls-06-contrib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
id: pulls-06-contrib
name: GitOps.PullRequestIssueManagement
description: Handles when a PR is opened with specific file paths
owner:
resource: repository
disabled: false
where:

# spell-checker:disable
configuration:
resourceManagementConfiguration:
eventResponderTasks:
- description: When a PR is reviewed, add as review contributor
if:
- or:
- payloadType: Pull_Request_Review
- payloadType: Pull_Request_Review_Comment
- or:
- isAction:
action: Submitted # for reviews
- isAction:
action: Created # for comments
- not:
targetsBranch:
branch: main
- isActivitySender:
issueAuthor: false
- not:
or:
- isActivitySender:
user: allcontributors
- isActivitySender:
user: aromano2
- isActivitySender:
user: benshy
- isActivitySender:
user: flanakin
- isActivitySender:
user: helderpinto
- isActivitySender:
user: msbrett
- isActivitySender:
user: springstone
then:
- addReply:
reply: '@all-contributors please add ${contextualAuthor} for review'
- description: When a PR is closed, add as contributor
if:
- payloadType: Pull_Request
- isAction:
action: Closed
- not:
targetsBranch:
branch: main
then:
# all code
- if:
- or:
- filesMatchPattern:
pattern: ^(\.build|\.github|\.vscode|src\/scripts)\/.*
- filesMatchPattern:
pattern: ^src\/.*
- not:
or:
- isActivitySender:
user: aromano2
- isActivitySender:
user: arthurclares
- isActivitySender:
user: didayal-msft
- isActivitySender:
user: flanakin
- isActivitySender:
user: msbrett
- isActivitySender:
user: nteyan
- isActivitySender:
user: saadmsft
- isActivitySender:
user: sebassem
- isActivitySender:
user: springstone
then:
- addReply:
reply: '@all-contributors please add ${issueAuthor} for code'
# docs
- if:
- filesMatchPattern:
pattern: ^(docs|docs-mslearn|docs-wiki)\/.*
- not:
or:
- isActivitySender:
user: aromano2
- isActivitySender:
user: benshy
- isActivitySender:
user: flanakin
- isActivitySender:
user: helderpinto
- isActivitySender:
user: msbrett
- isActivitySender:
user: springstone
then:
- addReply:
reply: '@all-contributors please add ${issueAuthor} for doc'
onFailure:
onSuccess:

0 comments on commit e74ad20

Please sign in to comment.