From 92dce12778f2e63d7f7391201492ea7257daa962 Mon Sep 17 00:00:00 2001 From: Chad Fawcett Date: Mon, 12 Feb 2024 14:52:21 -0800 Subject: [PATCH] Alert branch protection settings change part 2 (#49178) --- .github/workflows/alert-changed-branch-protections.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/alert-changed-branch-protections.yml b/.github/workflows/alert-changed-branch-protections.yml index 54378f4fc4..7f68108ea0 100644 --- a/.github/workflows/alert-changed-branch-protections.yml +++ b/.github/workflows/alert-changed-branch-protections.yml @@ -1,6 +1,7 @@ name: Alert Changed Branch Protections on: + branch_protection_rule: workflow_dispatch: permissions: @@ -22,6 +23,8 @@ jobs: - name: Fetch branch protections id: fetch + env: + GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WORKFLOW }} run: | # Fetch branch protections and store them in a file gh api /repos/GitHub/docs-internal/branches/${{ matrix.branch }}/protection > ${{ matrix.branch }}-actual.json @@ -35,10 +38,10 @@ jobs: id: compare run: | # Compare the fetched branch protections with the committed ones - git diff --no-index .github/branch_protection_settings/${{ matrix.branch }}.json ${{ matrix.branch }}-actual.json > ${{ matrix.branch }}-diff.tmp + git diff --no-index .github/branch_protection_settings/${{ matrix.branch }}.json ${{ matrix.branch }}-actual.json - uses: ./.github/actions/slack-alert - if: ${{ steps.compare.outputs.exit-code != 0 && github.event_name != 'workflow_dispatch' }} + if: ${{ failure() && github.event_name != 'workflow_dispatch' }} with: slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}