From 9c0f75adb1440b87cfbb4dcf5239c627a0c6f7e3 Mon Sep 17 00:00:00 2001 From: "Jason T. Greene" Date: Fri, 15 Mar 2024 23:29:57 -0500 Subject: [PATCH] Add Github email notification --- .github/workflows/email.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/email.yml diff --git a/.github/workflows/email.yml b/.github/workflows/email.yml new file mode 100644 index 0000000..3336ab1 --- /dev/null +++ b/.github/workflows/email.yml @@ -0,0 +1,30 @@ +on: + check_suite: + type: ['completed'] + +name: Email about Cirrus CI failures +jobs: + continue: + name: After Cirrus CI Failure + if: >- + github.event.check_suite.app.name == 'Cirrus CI' + && github.event.check_suite.conclusion != 'success' + && github.event.check_suite.conclusion != 'cancelled' + && github.event.check_suite.conclusion != 'skipped' + && github.event.check_suite.conclusion != 'neutral' + runs-on: ubuntu-latest + steps: + - uses: octokit/request-action@v2.x + id: get_failed_check_run + with: + route: GET /repos/${{ github.repository }}/check-suites/${{ github.event.check_suite.id }}/check-runs?status=completed + mediaType: '{"previews": ["antiope"]}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: | + echo "Cirrus CI ${{ github.event.check_suite.conclusion }} on ${{ github.event.check_suite.head_branch }} branch!" + echo "SHA ${{ github.event.check_suite.head_sha }}" + echo $MESSAGE + echo "##[error]See $CHECK_RUN_URL for details" && false + env: + CHECK_RUN_URL: ${{ fromJson(steps.get_failed_check_run.outputs.data).check_runs[0].html_url }}