ci: skip discord notification on release when no token (#1020)

This commit is contained in:
James Ward
2026-04-30 22:40:28 -04:00
committed by GitHub
parent 54340628c1
commit f44661318b
2 changed files with 32 additions and 1 deletions
+16 -1
View File
@@ -185,13 +185,28 @@ jobs:
release_type: ${{ steps.notes.outputs.release_type }}
released: ${{ steps.notes.outputs.released }}
to_sha: ${{ steps.notes.outputs.to_sha }}
available: ${{ steps.webhook_secrets_check.outputs.available }}
steps:
- name: Check Discord Webhook secrets
id: webhook_secrets_check
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK != '' && secrets.DISCORD_NIGHTLY_WEBHOOK || secrets.DISCORD_RELEASE_WEBHOOK }}
run: |
# Check here rather than in the `if`.
# Github actions does not support the `secrets` context in `if` blocks.
if [[ -n "${DISCORD_WEBHOOK}" ]]; then
echo "available=true" >> $GITHUB_OUTPUT
else
echo "available=false" >> $GITHUB_OUTPUT
fi
- name: Checkout Workflow Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
- name: Build Full Changelog
if: ${{ steps.webhook_secrets_check.outputs.available == 'true' }}
id: notes
uses: ./.github/actions/compute-release-notes
with:
@@ -202,7 +217,7 @@ jobs:
notify-discord:
name: Notify Discord (Nightly)
if: ${{ always() && needs.generate-notes.result == 'success' && needs.build-and-push.result == 'success' && needs.export-openapi.result == 'success' && needs.generate-notes.outputs.predicted_version != '' }}
if: ${{ always() && needs.generate-notes.result == 'success' && needs.build-and-push.result == 'success' && needs.export-openapi.result == 'success' && needs.generate-notes.outputs.available == 'true' && needs.generate-notes.outputs.predicted_version != '' }}
needs: [resolve_ref, build-and-push, export-openapi, generate-notes]
permissions: {}
uses: ./.github/workflows/notify-discord-release-notes.yml
+16
View File
@@ -82,11 +82,25 @@ jobs:
outputs:
base_tag: ${{ steps.metadata.outputs.base_tag }}
compare_url: ${{ steps.metadata.outputs.compare_url }}
available: ${{ steps.webhook_secrets_check.outputs.available }}
permissions:
contents: read
steps:
- name: Check Discord Webhook secrets
id: webhook_secrets_check
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_STABLE_WEBHOOK }}
run: |
# Check here rather than in the `if`.
# Github actions does not support the `secrets` context in `if` blocks.
if [[ -n "${DISCORD_WEBHOOK}" ]]; then
echo "available=true" >> $GITHUB_OUTPUT
else
echo "available=false" >> $GITHUB_OUTPUT
fi
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
@@ -95,6 +109,7 @@ jobs:
- name: Extract Stable Release Metadata
id: metadata
if: ${{ steps.webhook_secrets_check.outputs.available == 'true' }}
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_URL: ${{ github.event.release.html_url }}
@@ -117,6 +132,7 @@ jobs:
name: Notify Discord Release
needs:
- prepare-release-notification
if: ${{ needs.prepare-release-notification.outputs.available == 'true' }}
permissions: {}
uses: ./.github/workflows/notify-discord-release-notes.yml
secrets: