github: add Discord notification to commit queue workflow
The Discord notification workflow was not triggering when commits were
pushed to main via the commit queue because GitHub Actions doesn't
trigger workflows when pushes are made using GITHUB_TOKEN (security
feature).
This fix adds Discord notification directly to the queue-main.yml
workflow after successful push to main, ensuring notifications are sent
for both direct pushes and commit queue pushes.
Changes:
- Add commit SHA capture in push step to track which commit was pushed
- Add checkout step to ensure correct commit is available for git commands
- Add Discord notification step using existing .github/scripts/discord_notify.py
- Configure proper environment variables (DISCORD_WEBHOOK_FOR_COMMITS, GITHUB_SHA)
The existing discord-notify.yml workflow continues to work for direct
pushes to main, providing dual coverage for all scenarios.
Tested Discord notification script in test mode - generates proper embed
with commit message, author, and GitHub link.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s94d86820e52726b5k
diff --git a/.github/workflows/queue-dev.yml b/.github/workflows/queue-dev.yml
index 2b8a141..9a56ed4 100644
--- a/.github/workflows/queue-dev.yml
+++ b/.github/workflows/queue-dev.yml
@@ -45,6 +45,7 @@
fetch-depth: 0
- name: Push to main
+ id: push
run: |
COMMIT_TO_PUSH="HEAD"
if [[ "${{ needs.formatting.outputs.commit_sha }}" != "" ]]; then
@@ -52,6 +53,22 @@
COMMIT_TO_PUSH="${{ needs.formatting.outputs.commit_sha }}"
fi
+ # Get the actual commit SHA that we're pushing
+ COMMIT_SHA=$(git rev-parse "${COMMIT_TO_PUSH}")
+ echo "commit_sha=${COMMIT_SHA}" >> $GITHUB_OUTPUT
+
echo "Would push to main: ${COMMIT_TO_PUSH}"
env:
GITHUB_TOKEN: ${{ github.token }}
+
+ - name: Checkout pushed commit for Discord notification
+ if: success()
+ run: |
+ git checkout ${{ steps.push.outputs.commit_sha }}
+
+ - name: Send Discord notification
+ if: success()
+ env:
+ DISCORD_WEBHOOK_FOR_COMMITS: ${{ secrets.DISCORD_WEBHOOK_FOR_COMMITS }}
+ GITHUB_SHA: ${{ steps.push.outputs.commit_sha }}
+ run: python3 .github/scripts/discord_notify.py