From aea1912d7b8c9a36b39ad0b0ab6dcda542fd2367 Mon Sep 17 00:00:00 2001 From: "James M. Greene" Date: Fri, 23 Oct 2020 16:04:39 -0500 Subject: [PATCH] Repo Sync updates (#16162) * Update to latest repo-sync/pull-request Action https://github.com/repo-sync/pull-request/pull/38 * Be more specific about the base branch when finding the PR * Further customize the Slack notification upon failure * Move repo freeze checks into a separate job to avoid Slack notifications every 15 minutes during freezes * Add new workflow to remind us about deployment freezes preventing repo-sync once per day --- .github/allowed-actions.js | 2 +- .github/workflows/repo-freeze-reminders.yml | 24 +++++++++++++++++++++ .github/workflows/repo-sync.yml | 18 ++++++++++++---- 3 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/repo-freeze-reminders.yml diff --git a/.github/allowed-actions.js b/.github/allowed-actions.js index 8c907b54a110..292d59056550 100644 --- a/.github/allowed-actions.js +++ b/.github/allowed-actions.js @@ -31,7 +31,7 @@ module.exports = [ 'rachmari/actions-add-new-issue-to-column@1a459ef92308ba7c9c9dc2fcdd72f232495574a9', 'rachmari/labeler@832d42ec5523f3c6d46e8168de71cd54363e3e2e', 'repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88', - 'repo-sync/pull-request@ea6773388b83b337e4da9a223293309f2c3670e7', + 'repo-sync/pull-request@58af525d19d3c2b4f744d3348c6823b6340a4921', 'rtCamp/action-slack-notify@e17352feaf9aee300bf0ebc1dfbf467d80438815', 'tjenkinson/gh-action-auto-merge-dependency-updates@cee2ac0' ] diff --git a/.github/workflows/repo-freeze-reminders.yml b/.github/workflows/repo-freeze-reminders.yml new file mode 100644 index 000000000000..be29ec555326 --- /dev/null +++ b/.github/workflows/repo-freeze-reminders.yml @@ -0,0 +1,24 @@ +name: Repo Freeze Reminders + +on: + schedule: + - cron: "00 11 * * *" # once per day around 11:00am UTC + +env: + FREEZE: ${{ secrets.FREEZE }} + +jobs: + check-freezer: + name: Remind about deployment freezes + runs-on: ubuntu-latest + steps: + + - name: Send Slack notification if repo is frozen + if: ${{ env.FREEZE == 'true' }} + uses: rtCamp/action-slack-notify@e17352feaf9aee300bf0ebc1dfbf467d80438815 + env: + SLACK_WEBHOOK: ${{ secrets.DOCS_ALERTS_SLACK_WEBHOOK }} + SLACK_USERNAME: docs-repo-sync + SLACK_ICON_EMOJI: ':freezing_face:' + SLACK_COLOR: '#51A0D5' # Carolina Blue + SLACK_MESSAGE: All repo-sync runs will fail for ${{ github.repository }} because the repo is currently frozen! diff --git a/.github/workflows/repo-sync.yml b/.github/workflows/repo-sync.yml index a44dbbe3719c..daf0f939bbc7 100644 --- a/.github/workflows/repo-sync.yml +++ b/.github/workflows/repo-sync.yml @@ -14,8 +14,8 @@ env: FREEZE: ${{ secrets.FREEZE }} jobs: - repo-sync: - name: Repo Sync + check-freezer: + name: Check for deployment freezes runs-on: ubuntu-latest steps: @@ -25,6 +25,12 @@ jobs: echo 'The repo is currently frozen! Exiting this workflow.' exit 1 # prevents further steps from running + repo-sync: + name: Repo Sync + needs: check-freezer + runs-on: ubuntu-latest + steps: + - name: Check out repo uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 @@ -39,7 +45,7 @@ jobs: github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} - name: Create pull request - uses: repo-sync/pull-request@ea6773388b83b337e4da9a223293309f2c3670e7 + uses: repo-sync/pull-request@58af525d19d3c2b4f744d3348c6823b6340a4921 env: GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }} with: @@ -56,6 +62,7 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} branch: repo-sync + base: main - name: Approve pull request if: ${{ steps.find-pull-request.outputs.number }} @@ -66,7 +73,10 @@ jobs: - name: Send Slack notification if workflow fails uses: rtCamp/action-slack-notify@e17352feaf9aee300bf0ebc1dfbf467d80438815 - if: failure() + if: ${{ failure() }} env: SLACK_WEBHOOK: ${{ secrets.DOCS_ALERTS_SLACK_WEBHOOK }} + SLACK_USERNAME: docs-repo-sync + SLACK_ICON_EMOJI: ':ohno:' + SLACK_COLOR: '#B90E0A' # Crimson SLACK_MESSAGE: The last repo-sync run for ${{github.repository}} failed. See https://github.com/${{github.repository}}/actions?query=workflow%3A%22Repo+Sync%22