|
| 1 | +name: Notify about production deployment |
| 2 | + |
| 3 | +# **What it does**: Posts a comment on the PR whose merge got into production. |
| 4 | +# **Why we have it**: So that the PR author can be informed when their merged PR is in production. |
| 5 | +# **Who does it impact**: Writers |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + workflow_run: |
| 10 | + # Note, we could do this after the "Purge Fastly" finished |
| 11 | + workflows: ['Azure Production - Build and Deploy'] |
| 12 | + types: |
| 13 | + - completed |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + pull-requests: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + find-pr-and-post-comment: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Check out repo |
| 24 | + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 |
| 25 | + |
| 26 | + - uses: ./.github/actions/node-npm-setup |
| 27 | + |
| 28 | + # The "Purge Fastly" action takes about 6 minutes to purge all |
| 29 | + # languages. First does the language agnostic URLs, then English, |
| 30 | + # then all the other languages. |
| 31 | + # So it takes about ~30 seconds until it has sent the purge for |
| 32 | + # all English docs. |
| 33 | + - name: Sleep a little to give Fastly Purge a chance |
| 34 | + run: sleep 30 |
| 35 | + |
| 36 | + - name: Find last PR |
| 37 | + id: get-number |
| 38 | + timeout-minutes: 3 |
| 39 | + env: |
| 40 | + GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }} |
| 41 | + run: .github/actions-scripts/find-past-built-pr.js |
| 42 | + |
| 43 | + - name: Find content directory changes comment |
| 44 | + if: ${{ steps.get-number.outputs.number != '' }} |
| 45 | + uses: peter-evans/find-comment@f4499a714d59013c74a08789b48abe4b704364a0 |
| 46 | + id: findComment |
| 47 | + with: |
| 48 | + issue-number: ${{ steps.get-number.outputs.number }} |
| 49 | + comment-author: 'github-actions[bot]' |
| 50 | + body-includes: '<!-- GONE_TO_PRODUCTION -->' |
| 51 | + |
| 52 | + - name: Update comment |
| 53 | + if: ${{ steps.get-number.outputs.number != '' }} |
| 54 | + uses: peter-evans/create-or-update-comment@c9fcb64660bc90ec1cc535646af190c992007c32 |
| 55 | + with: |
| 56 | + comment-id: ${{ steps.findComment.outputs.comment-id }} |
| 57 | + issue-number: ${{ steps.get-number.outputs.number }} |
| 58 | + body: | |
| 59 | + <!-- GONE_TO_PRODUCTION --> |
| 60 | + 🚀 **This pull request has gone into production!** |
| 61 | +
|
| 62 | + The SHA of https://docs.github.com/_build matches the merge commit in this PR. |
| 63 | + edit-mode: replace |
0 commit comments