Skip to content

Commit

Permalink
Merge branch 'main' into wara-guidance
Browse files Browse the repository at this point in the history
  • Loading branch information
oZakari authored Oct 17, 2024
2 parents 8ba293e + a44f39b commit 2662e16
Show file tree
Hide file tree
Showing 356 changed files with 23,507 additions and 4,002 deletions.
20 changes: 13 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

# Overview/Summary

Replace this with a brief description of what this Pull Request fixes, changes, etc.
<!-- Thank you for your contribution! Please add a brief description of what this Pull Request fixes, changes, etc. -->

## Related Issues/Work Items

Replace this with a list of related GitHub Issues and/or ADO Work Items (Internal Only)

<!--
- To associate a GitHub Issue, use a [key word](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) preceded with the GitHub issue number.
- To associate an ADO Work Item, use the key word `AB#` succeeded with the [ADO Work Item ID](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).
## This PR fixes/adds/changes/removes
Examples:
Fixes #123
Resolves #123
Closes #789
1. _Replace me_
2. _Replace me_
- To associate an ADO Work Item (internal Microsoft team member), use the key word `AB#` succeeded with the [ADO Work Item ID](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).
Examples:
Fixes AB#123
-->

### Breaking Changes

Expand All @@ -23,6 +27,8 @@ Replace this with a list of related GitHub Issues and/or ADO Work Items (Interna

## As part of this pull request I have

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Read the [Contribution Guide](https://azure.github.io/Azure-Proactive-Resiliency-Library-v2/contributing) and ensured this PR is compliant with the guide
- [ ] Checked for duplicate [Pull Requests](https://github.com/Azure/Azure-Proactive-Resiliency-Library-v2/pulls)
- [ ] Associated it with relevant [GitHub Issues](https://github.com/Azure/Azure-Proactive-Resiliency-Library-v2/issues) or ADO Work Items (Internal Only)
Expand Down
18 changes: 18 additions & 0 deletions .github/actions-config/gh-ado-sync-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"log_level": "info",
"ado": {
"organization": "CSUSolEng",
"project": "Well-Architected Framework",
"wit": "GitHub Issue",
"states": {
"new": "New",
"closed": "Closed",
"reopened": "New",
"deleted": "Removed",
"active": "In Progress"
},
"bypassRules": true,
"autoCreate": true,
"areaPath": "Well-Architected Framework"
}
}
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
interval: "weekly"
labels:
- "Type: Hygiene :broom:"
- "Needs: Attention from aprl-maintainers :wave:"
- "Auto-Merge :heavy_check_mark:"
284 changes: 284 additions & 0 deletions .github/policies/resource-management.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
name: GitOps.PullRequestIssueManagement
description: GitHub policy for triaging and managing pull requests and issues.
resource: repository
disabled: false

where:
configuration:
resourceManagementConfiguration:
scheduledSearches:
- description: 'If if open issue and label Needs: Author Feedback :ear: and Status: No Recent Activity :desert: with no update after 3 days, then close the issue.'
frequencies:
- hourly:
hour: 3
filters:
- isIssue
- isOpen
- hasLabel:
label: 'Needs: Author Feedback :ear:'
- hasLabel:
label: 'Status: No Recent Activity :desert:'
- noActivitySince:
days: 3
actions:
- closeIssue

- description: 'If open issue and label is Needs: Author Feedback :ear: is applied with no update after 3 days, then apply label "Status: No Recent Activity :desert:'
frequencies:
- hourly:
hour: 3
filters:
- isIssue
- isOpen
- hasLabel:
label: 'Needs: Author Feedback :ear:'
- noActivitySince:
days: 3
- isNotLabeledWith:
label: 'Status: No Recent Activity :desert:'
actions:
- addLabel:
label: 'Status: No Recent Activity :desert:'
- addReply:
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**.

- description: 'If open issue and label is Resolution: Duplicate :file_cabinet: with no activity for 1 day, close issue.'
frequencies:
- hourly:
hour: 3
filters:
- isIssue
- isOpen
- hasLabel:
label: 'Resolution: Duplicate :file_cabinet:'
- noActivitySince:
days: 1
actions:
- addReply:
reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes.
- closeIssue

- description: 'If open pr and label includes Needs: Author Feedback :ear: and Status: No Recent Activity :desert: with no update after 7 days, then close the issue.'
frequencies:
- hourly:
hour: 3
filters:
- isPullRequest
- isOpen
- hasLabel:
label: 'Needs: Author Feedback :ear:'
- hasLabel:
label: 'Status: No Recent Activity :desert:'
- noActivitySince:
days: 7
actions:
- closePullRequest

- description: 'If open pull request and label includes Needs: Author Feedback :ear: and has not been updated in 7 days, then add label and request update.'
frequencies:
- hourly:
hour: 3
filters:
- isPullRequest
- isOpen
- hasLabel:
label: 'Needs: Author Feedback :ear:'
- noActivitySince:
days: 7
- isNotLabeledWith:
label: 'Status: No Recent Activity :desert:'
actions:
- addLabel:
label: 'Status: No Recent Activity :desert:'
- addReply:
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**.

eventResponderTasks:
- if:
- payloadType: Issues
- titleContains:
pattern: "Bug Report"
isRegex: false
then:
- addLabel:
label: "Bug :lady_beetle:"
description: 'If issue title contains Bug Report, then add label.'

- if:
- payloadType: Issues
- titleContains:
pattern: "Feature Request"
isRegex: false
then:
- addLabel:
label: "Enhancement :new:"
description: 'If issue title contains Feature Request, then add label.'

- if:
- payloadType: Pull_Request
- titleContains:
pattern: "feat:"
isRegex: false
then:
- addLabel:
label: "Enhancement :new:"
description: 'If pr title contains feat:, then add label.'

- if:
- payloadType: Pull_Request
- titleContains:
pattern: "build:"
isRegex: false
then:
- addLabel:
label: "Type: Hygiene :broom:"
description: 'If pr title contains build:, then add label.'

- if:
- payloadType: Pull_Request
- titleContains:
pattern: "fix:"
isRegex: false
then:
- addLabel:
label: "Bug :lady_beetle:"
description: 'If pr title contains fix:, then add label.'

- if:
- payloadType: Issue_Comment
- isAction:
action: Created
- isActivitySender:
issueAuthor: True
- hasLabel:
label: 'Needs: Author Feedback :ear:'
- isOpen
then:
- addLabel:
label: 'Needs: Attention :wave:'
- removeLabel:
label: 'Needs: Author Feedback :ear:'
description: 'If author comments on issue with label Needs: Author Feedback :ear:, then adjust labels'

- if:
- payloadType: Issues
- not:
isAction:
action: Closed
- hasLabel:
label: 'Status: No Recent Activity :desert:'
then:
- removeLabel:
label: 'Status: No Recent Activity :desert:'
description: 'If issue is closed and had Status: No Recent Activity :desert:, then remove the label.'

- if:
- payloadType: Issue_Comment
- hasLabel:
label: 'Status: No Recent Activity :desert:'
then:
- removeLabel:
label: 'Status: No Recent Activity :desert:'
description: 'If comment on issue and has label Status: No Recent Activity :desert:, then remove the label.'

- if:
- payloadType: Pull_Request
- isAction:
action: Submitted
- isReviewState:
reviewState: Changes_requested
then:
- addLabel:
label: 'Needs: Author Feedback :ear:'
description: 'If pr has review that requests changes, then add label.'

- if:
- payloadType: Pull_Request
- isActivitySender:
issueAuthor: True
- not:
isAction:
action: Closed
- hasLabel:
label: 'Needs: Author Feedback :ear:'
then:
- removeLabel:
label: 'Needs: Author Feedback :ear:'
description: 'If pr has label Needs: Author Feedback :ear: and is closed, then remove label.'

- if:
- payloadType: Issue_Comment
- isActivitySender:
issueAuthor: True
- hasLabel:
label: 'Needs: Author Feedback :ear:'
then:
- removeLabel:
label: 'Needs: Author Feedback :ear:'
description: 'If issue has label Needs: Author Feedback :ear: and author comments, then remove label.'

- if:
- payloadType: Pull_Request
- isActivitySender:
issueAuthor: True
- hasLabel:
label: 'Needs: Author Feedback :ear:'
then:
- removeLabel:
label: 'Needs: Author Feedback :ear:'
description: 'If pull request has label Needs: Author Feedback :ear: and author updates, then remove label.'

- if:
- payloadType: Pull_Request
- not:
isAction:
action: Closed
- hasLabel:
label: 'Status: No Recent Activity :desert:'
then:
- removeLabel:
label: 'Status: No Recent Activity :desert:'
description: 'If pull request has label Status: No Recent Activity :desert: and is closed, then remove label.'

- if:
- payloadType: Issue_Comment
- hasLabel:
label: 'Status: No Recent Activity :desert:'
then:
- removeLabel:
label: 'Status: No Recent Activity :desert:'
description: 'If issue has new comment and has label Status: No Recent Activity :desert:, then remove label.'

- if:
- payloadType: Pull_Request
- hasLabel:
label: 'Status: No Recent Activity :desert:'
then:
- removeLabel:
label: 'Status: No Recent Activity :desert:'
description: 'If pull request has update and has label Status: No Recent Activity :desert:, then remove label.'

- if:
- payloadType: Issue_Comment
then:
- cleanEmailReply
description: 'If issue has new comment then perform cleanEmailReply action.'

- if:
- payloadType: Pull_Request
- hasLabel:
label: 'Auto-Merge :heavy_check_mark:'
then:
- enableAutoMerge:
mergeMethod: Squash
description: 'If pr opened and has label auto-merge :heavy_check_mark: added, then disableAutoMerge.'

- if:
- payloadType: Pull_Request
- labelRemoved:
label: 'Auto-Merge :heavy_check_mark:'
then:
- disableAutoMerge
description: 'If pr opened and has label auto-merge :heavy_check_mark: removed, then disableAutoMerge.'
onFailure:
onSuccess:
39 changes: 39 additions & 0 deletions .github/scripts/build-recommendation-object.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
install-module powershell-yaml -force -scope currentuser

function Build-APRLJsonObject {
param (
[string]$path
)

$kqlfiles = Get-ChildItem -Path $path -Recurse -Filter "*.kql"
$yamlfiles = Get-ChildItem -Path $path -Recurse -Filter "*.yaml"

$yamlobj = foreach($file in $yamlfiles){
$content = Get-Content $file.FullName -Raw | ConvertFrom-Yaml
$content | Select-Object publishedToAdvisor,aprlGuid,recommendationTypeId,recommendationMetadataState,learnMoreLink,recommendationControl,longDescription,pgVerified,description,potentialBenefits,publishedToLearn,tags,recommendationResourceType,recommendationImpact,automationAvailable,query
}

$kqlobj = foreach($file in $kqlfiles){
$content = Get-Content $file.FullName -Raw
[PSCustomObject]@{
AprlGUID = $file.Name -replace ".kql",""
Query = $content
}
}

$aprlobj = foreach($obj in $yamlobj){
$obj.query = $($kqlobj.Where{$_.AprlGUID -eq $obj.aprlGuid}).Query
$obj
}
return $aprlobj
}

#Try to build and export the object. If it fails, catch the error and exit with code 1
try{
Build-APRLJsonObject -path "./azure-resources" | ConvertTo-Json -Depth 10 | Out-File -FilePath "./tools/data/recommendations.json" -Force
exit 0
}
catch{
Write-Error $_.Exception.Message
exit 1
}
Loading

0 comments on commit 2662e16

Please sign in to comment.