From db0560c93cfce1db113927463655b4b299966dad Mon Sep 17 00:00:00 2001 From: Don Naro Date: Thu, 11 Jul 2024 10:06:29 +0100 Subject: [PATCH] notify docs matrix channel on docs build failures (#1651) * notify docs matrix channel on docs build failures * add url with run id --- .github/workflows/build-package-docs.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/build-package-docs.yaml b/.github/workflows/build-package-docs.yaml index 88050aeab27..e79db6f9787 100644 --- a/.github/workflows/build-package-docs.yaml +++ b/.github/workflows/build-package-docs.yaml @@ -131,6 +131,28 @@ jobs: echo "Owner: ${{ github.event.inputs.repository-owner }}" >> "${GITHUB_STEP_SUMMARY}" echo "Branch: ${{ github.event.inputs.repository-branch }}" >> "${GITHUB_STEP_SUMMARY}" + notify-build-failures: + if: failure() + needs: build-package-docs + runs-on: ubuntu-latest + env: + ROOM_URL: https://ansible-accounts.ems.host/_matrix/client/v3/rooms/!HJtetIFWYEIDBOXxFE:libera.chat/send/m.room.message + FAIL_MESSAGE: >- + Oh no! A community package docs build has failed. + Check this workflow run to see what went wrong: + https://github.com/ansible/ansible-documentation/actions/runs/${{ github.run_id }} + @orandon @samccann + steps: + - name: Set a transaction ID + run: echo "TX_ID=$(date +%s)" >> "${GITHUB_ENV}" + + - name: Notify the DaWGs in Matrix + run: | + curl -X PUT "${{ env.ROOM_URL }}/${TX_ID}" \ + -H "Authorization: Bearer ${{ secrets.DOCS_BOT_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{"msgtype": "m.text", "body": "${{ env.FAIL_MESSAGE }}"}' + deploy-package-docs: if: fromJSON(github.event.inputs.deploy) needs: build-package-docs