diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..151156d0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +# top-most EditorConfig file +root=true + +# Apply Windows-style newlines with a newline ending on every file, using UTF-8, and removing extra whitespace before newlines +[*] +end_of_line = crlf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true + +# Overrides for Yaml Files - Use two spaces for indents +# editorconfig/editorconfig#329 +[*.{yml,yaml}] +indent_style = space +indent_size = 2 + +# Overrides for Markdown Files - Use tab for indents (accessibility) +[*.md] +indent_style = tab + +[{allow.txt,excludes.txt,patterns.txt}] +end_of_line = lf diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..74a04a7b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +.editorconfig text eol=crlf +*.json text eol=crlf +*.md text eol=crlf +*.ps1 text eol=crlf +*.txt text eol=crlf +*.yml text=auto +*.yaml text=auto +.github/actions/spelling/** text eol=lf diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt index ab83a805..b5196fda 100644 --- a/.github/actions/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -12,7 +12,6 @@ github https Icm microsoft -MSFT msftbot numpy opencode @@ -37,3 +36,4 @@ prerel uilt Windo ELSPROBLEMS +requ diff --git a/.github/actions/spelling/expect/generic_terms.txt b/.github/actions/spelling/expect/generic_terms.txt index b6a59150..5a88fd33 100644 --- a/.github/actions/spelling/expect/generic_terms.txt +++ b/.github/actions/spelling/expect/generic_terms.txt @@ -10,3 +10,5 @@ VGpu versioning worktree sortby +msft +automerge diff --git a/.github/actions/spelling/expect/usernames.txt b/.github/actions/spelling/expect/usernames.txt index 90518d69..5bc89190 100644 --- a/.github/actions/spelling/expect/usernames.txt +++ b/.github/actions/spelling/expect/usernames.txt @@ -1,4 +1 @@ -denelon -Trenly ryfu -stephengillie diff --git a/.github/policies/labelAdded.authorNotAuthorized.yml b/.github/policies/labelAdded.authorNotAuthorized.yml new file mode 100644 index 00000000..7a1dee06 --- /dev/null +++ b/.github/policies/labelAdded.authorNotAuthorized.yml @@ -0,0 +1,34 @@ +id: labelAdded.authorNotAuthorized +name: GitOps.PullRequestIssueManagement +description: Handlers when "Author-Not-Authorized" label is added +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: >- + When the label "Author-Not-Authorized" is added to a pull request + * Add the PR specific reply notifying the issue author + * Label with Needs-Attention + if: + - payloadType: Pull_Request + - labelAdded: + label: Author-Not-Authorized + then: + - addReply: + reply: >- + ${issueAuthor}, + + + Changes to one or more files in your PR require authorization to modify. This PR has been assigned to our on call staff to evaluate. + + + Template: msftbot/requiresApproval/MSFT + - addLabel: + label: Needs-Attention # This will automatically assign the ICM Users + # The policy service should trigger even when the label was added by the policy service + triggerOnOwnActions: true +onFailure: +onSuccess: diff --git a/.github/policies/labelAdded.changesRequested.yml b/.github/policies/labelAdded.changesRequested.yml new file mode 100644 index 00000000..bacaf0d8 --- /dev/null +++ b/.github/policies/labelAdded.changesRequested.yml @@ -0,0 +1,37 @@ +id: labelAdded.changesRequested +name: GitOps.PullRequestIssueManagement +description: Handlers when "Changes-Requested" label is added +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: >- + When the label "Changes-Requested" is added to a pull request + * Add the PR specific reply notifying the issue author + * Assign to the Author + * Label with Needs-Author-Feedback + if: + - payloadType: Pull_Request + - labelAdded: + label: Changes-Requested + then: + - addReply: + reply: >- + Hello @${issueAuthor}, + + + The package manager bot determined changes have been requested to your PR. + + + Template: msftbot/changesRequested + - assignTo: + author: True + - addLabel: + label: Needs-Author-Feedback + # The policy service should trigger even when the label was added by the policy service + triggerOnOwnActions: true +onFailure: +onSuccess: diff --git a/.github/policies/labelAdded.needsCLA.yml b/.github/policies/labelAdded.needsCLA.yml new file mode 100644 index 00000000..ac12bf16 --- /dev/null +++ b/.github/policies/labelAdded.needsCLA.yml @@ -0,0 +1,31 @@ +id: labelAdded.needsCLA +name: GitOps.PullRequestIssueManagement +description: Handlers when "Needs-CLA" label is added +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: >- + When the label "Needs-CLA" is added to a pull request + * Add the PR specific reply notifying the issue they must sign the CLA + if: + - payloadType: Pull_Request + - labelAdded: + label: Needs-CLA + then: + - addReply: + reply: >- + Hello @${issueAuthor}, + + + This PR cannot be merged until you sign the Contributor License Agreement (CLA). More information on this process can be found on the [Microsoft Open Source](https://opensource.microsoft.com/cla/) website. + + + Template: msftbot/needsCLA + # The policy service should trigger even when the label was added by the policy service + triggerOnOwnActions: true +onFailure: +onSuccess: diff --git a/.github/policies/labelAdded.noRecentActivity.yml b/.github/policies/labelAdded.noRecentActivity.yml new file mode 100644 index 00000000..c0fb40b4 --- /dev/null +++ b/.github/policies/labelAdded.noRecentActivity.yml @@ -0,0 +1,50 @@ +id: labelAdded.noRecentActivity +name: GitOps.PullRequestIssueManagement +description: Handlers when "No-Recent-Activity" label is added +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: >- + When the label "No-Recent-Activity" is added to a pull request + * Add the PR specific reply notifying the issue author of pending closure + if: + - payloadType: Pull_Request + - labelAdded: + label: No-Recent-Activity + then: + - addReply: + reply: >- + Hello @${issueAuthor}, + + + This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any recent activity. It will be closed if no further activity occurs **within 3 days of this comment**. + + + Template: msftbot/noRecentActivity + # The policy service should trigger even when the label was added by the policy service + triggerOnOwnActions: true + - description: >- + When the label "No-Recent-Activity" is added to an issue + * Add the issue specific reply notifying the issue author of pending closure + if: + - payloadType: Issues + - labelAdded: + label: No-Recent-Activity + then: + - addReply: + reply: >- + Hello @${issueAuthor}, + + + This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any recent activity. It will be closed if no further activity occurs **within 3 days of this comment**. + + + Template: msftbot/noRecentActivity + # The policy service should trigger even when the label was added by the policy service + triggerOnOwnActions: true +onFailure: +onSuccess: diff --git a/.github/policies/labelAdded.projectFile.yml b/.github/policies/labelAdded.projectFile.yml new file mode 100644 index 00000000..63c493a9 --- /dev/null +++ b/.github/policies/labelAdded.projectFile.yml @@ -0,0 +1,34 @@ +id: labelAdded.projectFile +name: GitOps.PullRequestIssueManagement +description: Handlers when "Project-File" label is added +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: >- + When the label "Project-File" is added to a pull request + * Add the PR specific reply notifying the issue author + * Label with Needs-Attention + if: + - payloadType: Pull_Request + - labelAdded: + label: Project-File + then: + - addReply: + reply: >- + ${issueAuthor}, + + + Changes to one or more files in your PR require authorization to modify. This PR has been assigned to our on call staff to evaluate. + + + Template: msftbot/requiresApproval/MSFT + - addLabel: + label: Needs-Attention # This will automatically assign the ICM Users + # The policy service should trigger even when the label was added by the policy service + triggerOnOwnActions: true +onFailure: +onSuccess: diff --git a/.github/policies/labelManagement.assignIcmUsersAndModerators.yml b/.github/policies/labelManagement.assignIcmUsersAndModerators.yml new file mode 100644 index 00000000..52e85eab --- /dev/null +++ b/.github/policies/labelManagement.assignIcmUsersAndModerators.yml @@ -0,0 +1,37 @@ +id: labelAdded.assignIcmUsersAndModerators +name: GitOps.PullRequestIssueManagement +description: When these labels are added, the ICM Primary and secondary user should be assigned +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: >- + When any label below is added to a PR + * Assign the ICM users + - if: + - payloadType: Pull_Request + - or: + - labelAdded: + label: Needs-Attention + - labelAdded: + label: Internal-Error + - labelAdded: + label: Author-Not-Authorized + then: + - assignTo: + user: ryfu-msft + # - assignIcmUsers: + # teamId: 85579 + # primary: True + # secondary: False + # - assignIcmUsers: + # teamId: 85579 + # primary: False + # secondary: True + # The policy service should trigger even when the label was added by the policy service + triggerOnOwnActions: true +onFailure: +onSuccess: diff --git a/.github/policies/labelManagement.issueClosed.yml b/.github/policies/labelManagement.issueClosed.yml new file mode 100644 index 00000000..e58184d7 --- /dev/null +++ b/.github/policies/labelManagement.issueClosed.yml @@ -0,0 +1,38 @@ +id: labelManagement.issueClosed +name: GitOps.PullRequestIssueManagement +description: Handlers when an issue gets closed +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: Remove labels when an issue is closed + if: + - payloadType: Issues + - isAction: + action: Closed + then: + - removeLabel: + label: Needs-Triage + - removeLabel: + label: Needs-Attention + - removeLabel: + label: Needs-Author-Feedback + - removeLabel: + label: Help-Wanted + ## TODO: Unassign author + - description: Remove labels when a pull request is closed + if: + - payloadType: Pull_Request + - isAction: + action: Closed + then: + - removeLabel: + label: Needs-Attention + - removeLabel: + label: Needs-Author-Feedback + ## TODO: Unassign ICM Users +onFailure: +onSuccess: diff --git a/.github/policies/labelManagement.issueOpened.yml b/.github/policies/labelManagement.issueOpened.yml new file mode 100644 index 00000000..b10df136 --- /dev/null +++ b/.github/policies/labelManagement.issueOpened.yml @@ -0,0 +1,117 @@ +id: labelManagement.issueOpened +name: GitOps.PullRequestIssueManagement +description: Handlers for when an issue is first opened +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: >- + When a PR is opened/updated, if no files are modified + * Close the issue + * Add a comment + if: + - payloadType: Pull_Request + - isOpen + - or: + - isAction: + action: Opened + - isAction: + action: Synchronize + - filesMatchPattern: + pattern: ^$ + then: + - addReply: + reply: >- + Hello @${issueAuthor}, + + + This pull request does not update any files. Please review your commit history and resubmit. + + + Template: msftbot/validationError/pullRequest/noContent + - closePullRequest + - description: Add CodeFlow link to new PRs + if: + - payloadType: Pull_Request + - isAction: + action: Opened + then: + - addCodeFlowLink + # If the user is a first-time contributor, add the Needs-CLA Label + - if: + - activitySenderHasAssociation: + association: FIRST_TIME_CONTRIBUTOR + then: + - addLabel: + label: Needs-CLA + - description: Add Needs-Triage to new issues + if: + - payloadType: Issues + - isAction: + action: Opened + then: + - addLabel: + label: Needs-Triage + - description: >- + When a pull request is opened, if the files match DevOpsPipelineDefinitions/* + * Add a message to the author + * Assign to the author + * Add the "Needs-Author-Feedback" label + - description: >- + When a PR is opened/updated, if the content is in a project folder and user is not repo admin + * Add Project-File label + if: + - payloadType: Pull_Request + - isOpen + - not: + filesMatchPattern: + pattern: ^$ + - or: + - filesMatchPattern: + pattern: ^.github\\.* + - filesMatchPattern: + pattern: ^.configurations\\.* + - filesMatchPattern: + pattern: ^.vscode\\.* + - filesMatchPattern: + pattern: ^doc\\.* + - filesMatchPattern: + pattern: ^Tools\\.* + - filesMatchPattern: + pattern: ^.*\.md$ + - filesMatchPattern: + pattern: ^.gitattributes$ + - filesMatchPattern: + pattern: ^.gitignore$ + - filesMatchPattern: + pattern: ^.editorconfig$ + - filesMatchPattern: + pattern: ^LICENSE$ + - not: + activitySenderHasPermission: + permission: Admin + then: + - addLabel: + label: Project-File + - description: >- + When a PR is opened/updated, if the content is in the pipelines and user is not repo admin + * Add Author-Not-Authorized label + if: + - payloadType: Pull_Request + - isOpen + - not: + filesMatchPattern: + pattern: ^$ + - filesMatchPattern: + pattern: ^pipelines\\.* + - not: + activitySenderHasPermission: + permission: Admin + then: + - addLabel: + label: Author-Not-Authorized +onFailure: +onSuccess: diff --git a/.github/policies/labelManagement.issueUpdated.yml b/.github/policies/labelManagement.issueUpdated.yml new file mode 100644 index 00000000..b0710126 --- /dev/null +++ b/.github/policies/labelManagement.issueUpdated.yml @@ -0,0 +1,151 @@ +id: labelManagement.issueUpdated +name: GitOps.PullRequestIssueManagement +description: >- + Handlers for when an issue is updated and not closed + This primarily includes handlers for comments, reviews, and re-runs +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: Remove "No-Recent-Activity" when a pull request or issue is updated + if: + - or: + - payloadType: Pull_Request + - payloadType: Pull_Request_Review + - payloadType: Pull_Request_Review_Comment + - payloadType: Issue_Comment + - payloadType: Issues + - not: + isAction: + action: Closed + - hasLabel: + label: No-Recent-Activity + then: + - removeLabel: + label: No-Recent-Activity + # The policy service should not trigger itself here, or else the label would be removed immediately after being added + triggerOnOwnActions: False + - description: Clean email replies on every comment + if: + - payloadType: Issue_Comment + then: + - cleanEmailReply + - description: Sync labels with issues on all pull request events + if: + - or: + - payloadType: Pull_Request + - payloadType: Pull_Request_Review + - payloadType: Pull_Request_Review_Comment + - not: + isAction: + action: Closed + then: + - labelSync: + pattern: Blocking-Issue + - inPrLabel: + label: In-PR + - description: Remove "Help-Wanted" label when an issue goes into PR + if: + - payloadType: Issues + - labelAdded: + label: In-PR + - hasLabel: + label: Help-Wanted + then: + - removeLabel: + label: Help-Wanted + # The policy service should trigger even when the update was initiated by the policy service + triggerOnOwnActions: true + - description: >- + If an author responds to an issue which needs author feedback + * Remove the Needs-Author-Feedback Label + * Add the Needs-Attention Label + if: + - or: + - payloadType: Pull_Request_Review + - payloadType: Pull_Request_Review_Comment + - payloadType: Issue_Comment + - isActivitySender: + issueAuthor: True + - hasLabel: + label: Needs-Author-Feedback + - not: + isAction: + action: Synchronize + then: + - removeLabel: + label: Needs-Author-Feedback + - addLabel: + label: Needs-Attention # This will automatically assign the ICM Users + - description: >- + When changes are requested on a pull request + * Disable automerge + * Label with Changes-Requested + if: + - payloadType: Pull_Request_Review + - isAction: + action: Submitted + - isReviewState: + reviewState: Changes_requested + then: + - disableAutoMerge + - addLabel: + label: Changes-Requested + - description: Remove status labels when a PR is synchronized (new commits pushed) + if: + - payloadType: Pull_Request + - isAction: + action: Synchronize + then: + - removeLabel: + label: Azure-Pipeline-Passed + - removeLabel: + label: Blocking-Issue + - removeLabel: + label: Changes-Requested + # - removeLabel: + # label: Moderator-Approved + - removeLabel: + label: Needs-Attention + - removeLabel: + label: Needs-Author-Feedback + - removeLabel: + label: Unexpected-File + - description: Remove status labels when a PR is re-run + if: + - payloadType: Issue_Comment + - or: + - commentContains: + pattern: '\/[a|A][z|Z][p|P] [r|R][u|U][n|N]' + isRegex: True + - commentContains: + pattern: '\/[a|A][z|Z][u|U][r|R][e|E][p|P][i|I][p|P][e|E][l|L][i|I][n|N][e|E][s|S] [r|R][u|U][n|N]' + isRegex: True + - not: + isActivitySender: + user: microsoft-github-policy-service[bot] + issueAuthor: False + - or: + - activitySenderHasPermission: + permission: Admin + - activitySenderHasPermission: + permission: Write + then: + # Don't remove Changes-Requested here because it is just a re-run, no new commits have been added + - removeLabel: + label: Author-Not-Authorized + - removeLabel: + label: Azure-Pipeline-Passed + - removeLabel: + label: Blocking-Issue + - removeLabel: + label: Needs-Attention + - removeLabel: + label: Needs-Author-Feedback + - removeLabel: + label: Project-File +onFailure: +onSuccess: diff --git a/.github/policies/moderatorTriggers.yml b/.github/policies/moderatorTriggers.yml new file mode 100644 index 00000000..dbbc1ee5 --- /dev/null +++ b/.github/policies/moderatorTriggers.yml @@ -0,0 +1,370 @@ +id: moderatorTriggers +name: GitOps.PullRequestIssueManagement +description: Defines the users and permissions for the moderators +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - if: + # If the activity sender is any one of the moderators, has Admin permission on the repo, or has Write permissions on the repo. . . + - or: + - activitySenderHasPermission: + permission: Admin + - activitySenderHasPermission: + permission: Write + - isActivitySender: + user: stephengillie + issueAuthor: False + - isActivitySender: + user: Trenly + issueAuthor: False + - isActivitySender: + user: mdanish-kh + issueAuthor: False + - isActivitySender: + user: russellbanks + issueAuthor: False + then: + # If the payload is an issue_Comment or a Pull_Request_Review_Comment + - if: + - or: + - payloadType: Issue_Comment + - payloadType: Pull_Request_Review_Comment + # Remove the Needs-Triage label + # Take different actions based on the comment pattern + then: + - removeLabel: + label: Needs-Triage + # Area-Bots + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[aA]rea[\s-][bB]ots' + isRegex: True + then: + - addLabel: + label: Area-Bots + # Area-Validation-Pipeline + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[aA]rea[\s-][vV]alidation[\s-][pP]ipeline' + isRegex: True + then: + - addLabel: + label: Area-Validation-Pipeline + # Blocking-Issue + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[bB]locking[\s-][iI]ssue' + isRegex: True + then: + - removeLabel: + label: Needs-Author-Feedback + - removeLabel: + label: Needs-Attention + - addLabel: + label: Blocking-Issue + # GitDsc + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Gg]it\.[Dd][Ss][Cc]' + isRegex: True + then: + - addLabel: + label: GitDsc + # Help-Wanted + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[hH]elp[\s-][wW]anted' + isRegex: True + then: + - addLabel: + label: Help-Wanted + # In-PR + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Ii]n[\s-][Pp][Rr]' + isRegex: True + then: + - addLabel: + label: In-PR + # Issue-Bug + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[iI]ssue[\s-][bB]ug' + isRegex: True + then: + - addLabel: + label: Issue-Bug + # Issue-Docs + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[iI]ssue[\s-][dD]ocs' + isRegex: True + then: + - addLabel: + label: Issue-Docs + # Issue-Feature + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[iI]ssue[\s-][fF]eature' + isRegex: True + then: + - addLabel: + label: Issue-Feature + # Microsoft.DotNet.Dsc + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Mm]icrosoft\.[Dd]otnet\.[Dd][Ss][Cc]' + isRegex: True + then: + - addLabel: + label: Microsoft.DotNet.Dsc + # Microsoft.VSCode.Dsc + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Mm]icrosoft\.[Vv][Ss][Cc]ode\.[Dd][Ss][Cc]' + isRegex: True + then: + - addLabel: + label: Microsoft.VSCode.Dsc + # Microsoft.Windows.Developer + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Mm]icrosoft\.[Ww]indows\.[Dd]eveloper' + isRegex: True + then: + - addLabel: + label: Microsoft.Windows.Developer + # Microsoft.Windows.Setting.Accessibility + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Mm]icrosoft\.[Ww]indows\.[Ss]ettings?\.[Aa]ccessibility' + isRegex: True + then: + - addLabel: + label: Microsoft.Windows.Setting.Accessibility + # Microsoft.Windows.Setting.Language + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Mm]icrosoft\.[Ww]indows\.[Ss]ettings?\.[Ll]anguage' + isRegex: True + then: + - addLabel: + label: Microsoft.Windows.Setting.Language + # Microsoft.Windows.Setting.System + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Mm]icrosoft\.[Ww]indows\.[Ss]ettings?\.[Ss]ystem' + isRegex: True + then: + - addLabel: + label: Microsoft.Windows.Setting.System + # Microsoft.Windows.Setting + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Mm]icrosoft\.[Ww]indows\.[Ss]ettings?' + isRegex: True + then: + - addLabel: + label: Microsoft.Windows.Setting + # Moderator-Approved + # - if: + # - commentContains: + # pattern: '\[[Pp]olicy\]\s+[mM]oderator[\s-][Aa]pproved' + # isRegex: True + # then: + # - addLabel: + # label: Moderator-Approved + # Needs-Attention + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Nn]eeds[\s-][Aa]ttention' + isRegex: True + then: + - addLabel: + label: Needs-Attention + - addReply: + reply: >- + Hello ${issueAuthor}, + + + Your pull request requires attention from a repository administrator. It has been assigned to a developer for review. + + + Template: msftbot/manualReview + # Needs-Author-Feedback + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Nn]eeds[\s-][Aa]uthor[\s-][fF]eedback' + isRegex: True + then: + - addLabel: + label: Needs-Author-Feedback + # Needs-CLA + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Nn]eeds[\s-][Cc][Ll][Aa]' + isRegex: True + then: + - addLabel: + label: Needs-CLA + # New-DSC-Resource + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Nn]ew[\s-][Dd][Ss][Cc][\s-][Rr]esource' + isRegex: True + then: + - addLabel: + label: New-DSC-Resource + # NpmDsc + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Nn][Pp][Mm]\.[Dd][Ss][Cc]' + isRegex: True + then: + - addLabel: + label: NpmDsc + # PythonPip3Dsc + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Pp]ython[Pp]ip3?[Dd][Ss][Cc]' + isRegex: True + then: + - addLabel: + label: PythonPip3Dsc + # PSA + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Pp][Ss][Aa]' + isRegex: True + then: + - addLabel: + label: Public-Service-Announcement + # YarnDsc + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[Yy]arn\.[Dd][Ss][Cc]' + isRegex: True + then: + - addLabel: + label: YarnDsc + # Unblocked + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[uU]nblocked' + isRegex: True + then: + - removeLabel: + label: Blocking-Issue + # Reset-Feedback + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[rR]eset\s+[fF]eedback' + isRegex: True + then: + - removeLabel: + label: Needs-Author-Feedback + - removeLabel: + label: Needs-Attention + # - removeLabel: + # label: Moderator-Approved + - removeLabel: + label: Changes-Requested + # Reset-Labels + - if: + - commentContains: + pattern: '\[[Pp]olicy\]\s+[rR]eset[\s-]+[lL]abels' + isRegex: True + then: + - removeLabel: + label: Area-Bots + - removeLabel: + label: Area-Validation-Pipeline + - removeLabel: + label: Blocking-Issue + - removeLabel: + label: Changes-Requested + - removeLabel: + label: Help-Wanted + - removeLabel: + label: In-PR + - removeLabel: + label: Issue-Bug + - removeLabel: + label: Issue-Docs + - removeLabel: + label: Issue-Feature + # - removeLabel: + # label: Moderator-Approved + - removeLabel: + label: Needs-Attention + - removeLabel: + label: Needs-Author-Feedback + - removeLabel: + label: Needs-CLA + - removeLabel: + label: Project-File + - removeLabel: + label: Public-Service-Announcement + ## TODO: Dismiss All Pull Request Reviews + # Duplicate of # + - if: + - commentContains: + pattern: Duplicate\s+of\s+\#?\s*\d+ + isRegex: True + then: + - addReply: + reply: >- + Hello @${issueAuthor}, + + + We've identified this as a duplicate of another issue or PR that already exists. This specific instance is being closed in favor of the linked issue. Please add your 👍 to the other issue to raise its priority. Thanks for your contribution! + + + Template: msftbot/duplicate/closed + - closeIssue + - removeLabel: + label: Needs-Triage + - removeLabel: + label: Needs-Attention + - removeLabel: + label: Needs-Author-Feedback + - addLabel: + label: Resolution-Duplicate + # Close with reason <>; + - if: + - commentContains: + pattern: "[cC]lose\\s+[wW]ith\\s+[rR]eason\\s*:[\\w\\s\\-\\(\\)\\[\\]\\{\\}\\\\\\/.+=@\\#$%&^*`~|'\",<>?]*(?=;)" + isRegex: True + then: + - closeIssue + - removeLabel: + label: Needs-Triage + - removeLabel: + label: Needs-Attention + - removeLabel: + label: Needs-Author-Feedback + # Reopen with reason <>; + - if: + - commentContains: + pattern: "[rR]eopen\\s+[wW]ith\\s+[rR]eason\\s*:[\\w\\s\\-\\(\\)\\[\\]\\{\\}\\\\\\/.+=@\\#$%&^*`~|'\",<>?]*(?=;)" + isRegex: True + then: + - reopenIssue + - removeLabel: + label: Resolution-Duplicate + - removeLabel: + label: No-Recent-Activity + # If the payload is a Pull_Request_Review and an approval, add the Moderator-Approved label + # - if: + # - payloadType: Pull_Request_Review + # - isReviewState: + # reviewState: Approved + # then: + # - addLabel: + # label: Moderator-Approved +onFailure: +onSuccess: diff --git a/.github/policies/scheduledSearch.cleanupInPRLabels.yml b/.github/policies/scheduledSearch.cleanupInPRLabels.yml new file mode 100644 index 00000000..6bf1deb5 --- /dev/null +++ b/.github/policies/scheduledSearch.cleanupInPRLabels.yml @@ -0,0 +1,42 @@ +# Due to limitations in the policy service, it isn't possible to check on the state of the linked PRs because of this +# the assumption is made that if a linked PR is merged, the issue will be closed automatically. If the issue doesn't +# close, then the PR must not have been merged and is either stale or was closed. Since there is no way to check for +# that state specifically, the policy checks to see if there has been any activity on the issue. Any comments, labels +# or other actions on the issue will reset the 15 day period. + +id: scheduledSearch.cleanupInPRLabels +name: GitOps.PullRequestIssueManagement +description: Remove the In-PR label from issues where the PR has become stale +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: >- + Search for issues where - + * Issue is Open + * Issue has the label In-PR + * Has not had activity in the last 15 days + + Then - + * Remove In-PR label + * Add Help-Wanted label + frequencies: + - hourly: + hour: 12 + filters: + - isIssue + - isOpen + - hasLabel: + label: In-PR + - noActivitySince: + days: 15 + actions: + - removeLabel: + label: In-PR + - addLabel: + label: Help-Wanted +onFailure: +onSuccess: diff --git a/.github/policies/scheduledSearch.closeNoRecentActivity.yml b/.github/policies/scheduledSearch.closeNoRecentActivity.yml new file mode 100644 index 00000000..cbc302d3 --- /dev/null +++ b/.github/policies/scheduledSearch.closeNoRecentActivity.yml @@ -0,0 +1,64 @@ +id: scheduledSearch.closeNoRecentActivity +name: GitOps.PullRequestIssueManagement +description: Close stale issues and pull requests marked with "No-Recent-Activity" and "Needs-Author-Feedback" +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: >- + Search for PR where - + * Pull Request is Open + * Pull request has the label No-Recent-Activity + * Pull request has the label Needs-Author-Feedback + * Pull request does not have the label Blocking-Issue + * Has not had activity in the last 3 days + + Then - + * Close the PR + frequencies: + - hourly: + hour: 12 + filters: + - isPullRequest + - isOpen + - hasLabel: + label: No-Recent-Activity + - hasLabel: + label: Needs-Author-Feedback + - isNotLabeledWith: + label: Blocking-Issue + - noActivitySince: + days: 3 + actions: + - closeIssue + - description: >- + Search for Issues where - + * Issue is Open + * Issue has the label No-Recent-Activity + * Issue has the label Needs-Author-Feedback + * Issue does not have the label Blocking-Issue + * Has not had activity in the last 3 days + + Then - + * Close the Issue + frequencies: + - hourly: + hour: 12 + filters: + - isIssue + - isOpen + - hasLabel: + label: No-Recent-Activity + - hasLabel: + label: Needs-Author-Feedback + - isNotLabeledWith: + label: Blocking-Issue + - noActivitySince: + days: 3 + actions: + - closeIssue +onFailure: +onSuccess: diff --git a/.github/policies/scheduledSearch.markNoRecentActivity.yml b/.github/policies/scheduledSearch.markNoRecentActivity.yml new file mode 100644 index 00000000..df7cf2d9 --- /dev/null +++ b/.github/policies/scheduledSearch.markNoRecentActivity.yml @@ -0,0 +1,68 @@ +id: scheduledSearch.markNoRecentActivity +name: GitOps.PullRequestIssueManagement +description: Add "No-Recent-Activity" to stale issues and pull requests +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: >- + Search for PR where - + * Pull Request is Open + * Pull request does not have the label No-Recent-Activity + * Pull request does not have the label Blocking-Issue + * Pull request has the label Needs-Author-Feedback + * Has not had activity in the last 5 days + + Then - + * Add No-Recent-Activity label + - Triggers labelAdded.noRecentActivity.yml + frequencies: + - hourly: + hour: 12 + filters: + - isPullRequest + - isOpen + - isNotLabeledWith: + label: No-Recent-Activity + - isNotLabeledWith: + label: Blocking-Issue + - hasLabel: + label: Needs-Author-Feedback + - noActivitySince: + days: 5 + actions: + - addLabel: + label: No-Recent-Activity + - description: >- + Search for issues where - + * Issue is Open + * Issue does not have the label No-Recent-Activity + * Issue does not have the label Blocking-Issue + * Issue has the label Needs-Author-Feedback + * Has not had activity in the last 5 days + + Then - + * Add No-Recent-Activity label + - Triggers labelAdded.noRecentActivity.yml + frequencies: + - hourly: + hour: 12 + filters: + - isIssue + - isOpen + - isNotLabeledWith: + label: No-Recent-Activity + - isNotLabeledWith: + label: Blocking-Issue + - hasLabel: + label: Needs-Author-Feedback + - noActivitySince: + days: 5 + actions: + - addLabel: + label: No-Recent-Activity +onFailure: +onSuccess: diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..33d1ff21 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "redhat.vscode-yaml", + "EditorConfig.EditorConfig" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index e5dec5b4..2d799776 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { "powershell.codeFormatting.preset": "Allman", - "editor.formatOnSave": true -} \ No newline at end of file + "editor.formatOnSave": true, + "[powershell]": { + "files.encoding": "utf8bom", + "files.autoGuessEncoding": true + } +}