diff --git a/.github/workflows/build-notify.yml b/.github/workflows/build-notify.yml new file mode 100644 index 000000000000..b9ff2d39be22 --- /dev/null +++ b/.github/workflows/build-notify.yml @@ -0,0 +1,35 @@ +name: BuildNotify + +on: + workflow_run: + workflows: + - CI + - Release + types: [completed] + + +jobs: + notify: + if: > + github.event.workflow_run.conclusion == 'failure' && + ( + github.event.workflow_run.name != 'CI' || + github.event.workflow_run.head_branch == 'main' || + github.event.workflow_run.event == 'merge_group' + ) + runs-on: ubuntu-latest + steps: + - name: Notify Discord + env: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_GOOSE_STATUS }} + run: | + curl -sS --fail-with-body -H "Content-Type: application/json" \ + -d '{ + "embeds": [{ + "title": "❌ Build Failed", + "description": "**Workflow:** ${{ github.event.workflow_run.name }}\n**Branch:** ${{ github.event.workflow_run.head_branch }}\n**Commit:** ${{ github.event.workflow_run.head_sha }}", + "url": "${{ github.event.workflow_run.html_url }}", + "color": 15158332 + }] + }' \ + "$DISCORD_WEBHOOK_URL" \ No newline at end of file