From 771e8802cc9c9e36f116711866633486a21ffb58 Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Sat, 2 Nov 2024 11:43:48 -0700 Subject: [PATCH] Policy fix --- .github/policies/auto-merge.yml | 47 +++++++++++++++++++ .github/policies/scheduled-prod-sync.yml | 12 +++-- .github/policies/scheduled-stage-sync.yml | 12 +++-- ...-automatic-pr.yml => tag-automatic-pr.yml} | 15 ++---- 4 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 .github/policies/auto-merge.yml rename .github/policies/{handle-automatic-pr.yml => tag-automatic-pr.yml} (69%) diff --git a/.github/policies/auto-merge.yml b/.github/policies/auto-merge.yml new file mode 100644 index 0000000..4b93405 --- /dev/null +++ b/.github/policies/auto-merge.yml @@ -0,0 +1,47 @@ +id: +name: GitOps.PullRequestIssueManagement +description: GitOps.PullRequestIssueManagement primitive +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + eventResponderTasks: + - description: Approve and auto-squash-merge bot PRs to main labeled 'auto-merge' + triggerOnOwnActions: true + if: + - payloadType: Pull_Request + - labelAdded: + label: ':octocat: auto-merge' + - targetsBranch: + branch: main + - isActivitySender: + user: microsoft-github-policy-service[bot] + then: + - enableAutoMerge: + mergeMethod: Squash + - approvePullRequest: + comment: "Approved; this PR will merge when all status checks pass." + + - description: Auto-merge policy service bot PRs to live labeled 'auto-merge' + triggerOnOwnActions: true + if: + - payloadType: Pull_Request + - labelAdded: + label: ':octocat: auto-merge' + - targetsBranch: + branch: live + - isActivitySender: + user: microsoft-github-policy-service[bot] + then: + - enableAutoMerge: + mergeMethod: Merge + + - description: Don't auto-merge PRs with 'auto-merge' label removed + if: + - payloadType: Pull_Request + - labelRemoved: + label: ':octocat: auto-merge' + then: + - disableAutoMerge \ No newline at end of file diff --git a/.github/policies/scheduled-prod-sync.yml b/.github/policies/scheduled-prod-sync.yml index 97cbeb3..58015d5 100644 --- a/.github/policies/scheduled-prod-sync.yml +++ b/.github/policies/scheduled-prod-sync.yml @@ -16,8 +16,9 @@ configuration: head: main base: live title: Merge main into live - body: Automated merge of the main branch into live, syncing documentation content to the production environment. - - description: Push to live branch (scheduled 6PM PT publish) + body: Automated merge of the main branch into live. + + - description: Push to live branch (scheduled 7PM PT publish) frequencies: - daily: time: 2:00 @@ -27,8 +28,9 @@ configuration: head: main base: live title: Merge main into live - body: Automated merge of the main branch into live, syncing documentation content to the production environment. - - description: Push to live branch (scheduled 2AM PT publish) + body: Automated merge of the main branch into live. + + - description: Push to live branch (scheduled 3AM PT publish) frequencies: - daily: time: 10:00 @@ -38,4 +40,4 @@ configuration: head: main base: live title: Merge main into live - body: Automated merge of the main branch into live, syncing documentation content to the production environment. \ No newline at end of file + body: Automated merge of the main branch into live. diff --git a/.github/policies/scheduled-stage-sync.yml b/.github/policies/scheduled-stage-sync.yml index 0843cad..0ab4a18 100644 --- a/.github/policies/scheduled-stage-sync.yml +++ b/.github/policies/scheduled-stage-sync.yml @@ -16,8 +16,9 @@ configuration: head: smoke-test base: main title: Merge smoke-test into main - body: Automated merge of the smoke-test branch into main, syncing API documentation content to the staging environment. - - description: Push to main branch (scheduled 5PM PT publish) + body: Automated merge of the smoke-test branch into main. + + - description: Push to main branch (scheduled 6PM PT publish) frequencies: - daily: time: 1:00 @@ -27,8 +28,9 @@ configuration: head: smoke-test base: main title: Merge smoke-test into main - body: Automated merge of the smoke-test branch into main, syncing API documentation content to the staging environment. - - description: Push to main branch (scheduled 1AM PT publish) + body: Automated merge of the smoke-test branch into main. + + - description: Push to main branch (scheduled 2AM PT publish) frequencies: - daily: time: 9:00 @@ -38,4 +40,4 @@ configuration: head: smoke-test base: main title: Merge smoke-test into main - body: Automated merge of the smoke-test branch into main, syncing API documentation content to the staging environment. \ No newline at end of file + body: Automated merge of the smoke-test branch into main. diff --git a/.github/policies/handle-automatic-pr.yml b/.github/policies/tag-automatic-pr.yml similarity index 69% rename from .github/policies/handle-automatic-pr.yml rename to .github/policies/tag-automatic-pr.yml index d56b3b9..d1be251 100644 --- a/.github/policies/handle-automatic-pr.yml +++ b/.github/policies/tag-automatic-pr.yml @@ -8,7 +8,7 @@ where: configuration: resourceManagementConfiguration: eventResponderTasks: - - description: Sync API documentation to staging environment. + - description: Sync API docs to staging triggerOnOwnActions: true if: - payloadType: Pull_Request @@ -22,11 +22,8 @@ configuration: then: - addLabel: label: ':octocat: auto-merge' - - enableAutoMerge: - mergeMethod: Squash - - approvePullRequest: - comment: ':shipit:' - - description: Sync staging environment to production. + + - description: Sync staging to production triggerOnOwnActions: true if: - payloadType: Pull_Request @@ -39,8 +36,4 @@ configuration: isRegex: False then: - addLabel: - label: ':octocat: auto-merge' - - enableAutoMerge: - mergeMethod: Merge - - approvePullRequest: - comment: ':shipit:' \ No newline at end of file + label: ':octocat: auto-merge' \ No newline at end of file