Skip to content

Commit 5fdc730

Browse files
authored
hygeine: Triage policies (#176)
# Pull Request Adds Microsoft resource management policies to reduce overhead of repo. Issue #, if available: N/A ## Description Description of changes: Adds Microsoft resource management policies to reduce overhead of repo and adds workflow to require semantic versioning within PR titles. ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent db3f731 commit 5fdc730

File tree

2 files changed

+296
-0
lines changed

2 files changed

+296
-0
lines changed
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
id:
2+
name: GitOps.PullRequestIssueManagement
3+
description: GitOps.PullRequestIssueManagement primitive
4+
owner:
5+
resource: repository
6+
disabled: false
7+
where:
8+
configuration:
9+
resourceManagementConfiguration:
10+
scheduledSearches:
11+
- description:
12+
frequencies:
13+
- hourly:
14+
hour: 3
15+
filters:
16+
- isIssue
17+
- isOpen
18+
- hasLabel:
19+
label: "Needs: Author Feedback :ear:"
20+
- hasLabel:
21+
label: "Status: No Recent Activity :zzz:"
22+
- noActivitySince:
23+
days: 3
24+
actions:
25+
- closeIssue
26+
- description:
27+
frequencies:
28+
- hourly:
29+
hour: 3
30+
filters:
31+
- isIssue
32+
- isOpen
33+
- hasLabel:
34+
label: "Needs: Author Feedback :ear:"
35+
- noActivitySince:
36+
days: 4
37+
- isNotLabeledWith:
38+
label: "Status: No Recent Activity :zzz:"
39+
actions:
40+
- addLabel:
41+
label: "Status: No Recent Activity :zzz:"
42+
- addReply:
43+
reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
44+
- description:
45+
frequencies:
46+
- hourly:
47+
hour: 3
48+
filters:
49+
- isIssue
50+
- isOpen
51+
- hasLabel:
52+
label: "Type: Duplicate :palms_up_together:"
53+
- noActivitySince:
54+
days: 1
55+
actions:
56+
- addReply:
57+
reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes.
58+
- closeIssue
59+
- description:
60+
frequencies:
61+
- hourly:
62+
hour: 3
63+
filters:
64+
- isPullRequest
65+
- isOpen
66+
- hasLabel:
67+
label: "Needs: Author Feedback :ear:"
68+
- hasLabel:
69+
label: "Status: No Recent Activity :zzz:"
70+
- noActivitySince:
71+
days: 7
72+
actions:
73+
- closeIssue
74+
- description:
75+
frequencies:
76+
- hourly:
77+
hour: 3
78+
filters:
79+
- isPullRequest
80+
- isOpen
81+
- hasLabel:
82+
label: "Needs: Author Feedback :ear:"
83+
- noActivitySince:
84+
days: 7
85+
- isNotLabeledWith:
86+
label: "Status: No Recent Activity :zzz:"
87+
actions:
88+
- addLabel:
89+
label: "Status: No Recent Activity :zzz:"
90+
- addReply:
91+
reply: This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **7 days**. It will be closed if no further activity occurs **within 7 days of this comment**.
92+
eventResponderTasks:
93+
- if:
94+
- payloadType: Issue_Comment
95+
- isAction:
96+
action: Created
97+
- isActivitySender:
98+
issueAuthor: True
99+
- hasLabel:
100+
label: "Needs: Author Feedback :ear:"
101+
- isOpen
102+
then:
103+
- addLabel:
104+
label: "Needs: Attention :wave:"
105+
- removeLabel:
106+
label: "Needs: Author Feedback :ear:"
107+
description:
108+
- if:
109+
- payloadType: Issues
110+
- not:
111+
isAction:
112+
action: Closed
113+
- hasLabel:
114+
label: "Status: No Recent Activity :zzz:"
115+
then:
116+
- removeLabel:
117+
label: "Status: No Recent Activity :zzz:"
118+
description:
119+
- if:
120+
- payloadType: Issue_Comment
121+
- hasLabel:
122+
label: "Status: No Recent Activity :zzz:"
123+
then:
124+
- removeLabel:
125+
label: "Status: No Recent Activity :zzz:"
126+
description:
127+
- if:
128+
- payloadType: Pull_Request
129+
then:
130+
- inPrLabel:
131+
label: "Status: In PR :point_right:"
132+
description:
133+
- if:
134+
- payloadType: Pull_Request_Review
135+
- isAction:
136+
action: Submitted
137+
- isReviewState:
138+
reviewState: Changes_requested
139+
then:
140+
- addLabel:
141+
label: "Needs: Author Feedback :ear:"
142+
description:
143+
- if:
144+
- payloadType: Pull_Request
145+
- isActivitySender:
146+
issueAuthor: True
147+
- not:
148+
isAction:
149+
action: Closed
150+
- hasLabel:
151+
label: "Needs: Author Feedback :ear:"
152+
then:
153+
- removeLabel:
154+
label: "Needs: Author Feedback :ear:"
155+
description:
156+
- if:
157+
- payloadType: Issue_Comment
158+
- isActivitySender:
159+
issueAuthor: True
160+
- hasLabel:
161+
label: "Needs: Author Feedback :ear:"
162+
then:
163+
- removeLabel:
164+
label: "Needs: Author Feedback :ear:"
165+
description:
166+
- if:
167+
- payloadType: Pull_Request_Review
168+
- isActivitySender:
169+
issueAuthor: True
170+
- hasLabel:
171+
label: "Needs: Author Feedback :ear:"
172+
then:
173+
- removeLabel:
174+
label: "Needs: Author Feedback :ear:"
175+
description:
176+
- if:
177+
- payloadType: Pull_Request
178+
- not:
179+
isAction:
180+
action: Closed
181+
- hasLabel:
182+
label: "Status: No Recent Activity :zzz:"
183+
then:
184+
- removeLabel:
185+
label: "Status: No Recent Activity :zzz:"
186+
description:
187+
- if:
188+
- payloadType: Issue_Comment
189+
- hasLabel:
190+
label: "Status: No Recent Activity :zzz:"
191+
then:
192+
- removeLabel:
193+
label: "Status: No Recent Activity :zzz:"
194+
description:
195+
- if:
196+
- payloadType: Pull_Request_Review
197+
- hasLabel:
198+
label: "Status: No Recent Activity :zzz:"
199+
then:
200+
- removeLabel:
201+
label: "Status: No Recent Activity :zzz:"
202+
description:
203+
- if:
204+
- payloadType: Issue_Comment
205+
then:
206+
- cleanEmailReply
207+
description:
208+
- if:
209+
- payloadType: Pull_Request
210+
- isAction:
211+
action: Opened
212+
- or:
213+
- includesModifiedFiles:
214+
files:
215+
- infra-as-code/bicep/modules/policy/definitions/lib
216+
- includesModifiedFiles:
217+
files:
218+
- infra-as-code/bicep/modules/policy/assignments/lib/policy_assignments
219+
then:
220+
- addReply:
221+
reply: >-
222+
Hey ${issueAuthor}, thanks for creating this PR.
223+
224+
225+
We noticed that this PR is ammending some things related to policies (definitions or assignments) :mag:
226+
227+
228+
Thanks for this however, please keep in mind we replicate all policies from our upstream repo https://github.com/Azure/Enterprise-Scale (via some GitHub Actions) into these Bicep modules.
229+
230+
231+
So it may be that this PR may be closed and we ask you to re-submit the changes to the respective code in our other repo.
232+
233+
234+
However, we will review and advise further anyway but this is just a friendly premptive message and reminder of how policies are used and updated in this repo.
235+
236+
237+
Thanks from your friendly msft-bot.
238+
- addLabel:
239+
label: "Area: Policy"
240+
description:
241+
- if:
242+
- payloadType: Pull_Request
243+
- labelAdded:
244+
label: "Needs: Upstream Policy Changes :arrows_clockwise:"
245+
then:
246+
- addReply:
247+
reply: >-
248+
Hey ${issueAuthor}, thanks for creating this PR.
249+
250+
251+
We noticed that this PR is ammending some things related to policies (definitions or assignments) :mag:
252+
253+
254+
Thanks for this however, please keep in mind we replicate all policies from our upstream repo https://github.com/Azure/Enterprise-Scale (via some GitHub Actions) into these Bicep modules.
255+
256+
257+
We have determined, upon our review, that the changes here are required to be made to the upstream policies in the repo: https://github.com/Azure/Enterprise-Scale
258+
259+
260+
Thanks from the team and our friendly msft-bot.
261+
- closeIssue
262+
description:
263+
- if:
264+
- payloadType: Pull_Request
265+
- hasLabel:
266+
label: "auto-merge :heavy_check_mark:"
267+
then:
268+
- enableAutoMerge:
269+
mergeMethod: Squash
270+
description:
271+
- if:
272+
- payloadType: Pull_Request
273+
- labelRemoved:
274+
label: "auto-merge :heavy_check_mark:"
275+
then:
276+
- disableAutoMerge
277+
description:
278+
onFailure:
279+
onSuccess:

.github/workflows/pr-title-check.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: .Platform - Semantic PR Check
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Validate PR Title
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@v5
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)