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 }}