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 }} release_type: ${{ steps.notes.outputs.release_type }}
released: ${{ steps.notes.outputs.released }} released: ${{ steps.notes.outputs.released }}
to_sha: ${{ steps.notes.outputs.to_sha }} to_sha: ${{ steps.notes.outputs.to_sha }}
available: ${{ steps.webhook_secrets_check.outputs.available }}
steps: 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 - name: Checkout Workflow Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Build Full Changelog - name: Build Full Changelog
if: ${{ steps.webhook_secrets_check.outputs.available == 'true' }}
id: notes id: notes
uses: ./.github/actions/compute-release-notes uses: ./.github/actions/compute-release-notes
with: with:
@@ -202,7 +217,7 @@ jobs:
notify-discord: notify-discord:
name: Notify Discord (Nightly) 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] needs: [resolve_ref, build-and-push, export-openapi, generate-notes]
permissions: {} permissions: {}
uses: ./.github/workflows/notify-discord-release-notes.yml uses: ./.github/workflows/notify-discord-release-notes.yml
+16
View File
@@ -82,11 +82,25 @@ jobs:
outputs: outputs:
base_tag: ${{ steps.metadata.outputs.base_tag }} base_tag: ${{ steps.metadata.outputs.base_tag }}
compare_url: ${{ steps.metadata.outputs.compare_url }} compare_url: ${{ steps.metadata.outputs.compare_url }}
available: ${{ steps.webhook_secrets_check.outputs.available }}
permissions: permissions:
contents: read contents: read
steps: 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 - name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with: with:
@@ -95,6 +109,7 @@ jobs:
- name: Extract Stable Release Metadata - name: Extract Stable Release Metadata
id: metadata id: metadata
if: ${{ steps.webhook_secrets_check.outputs.available == 'true' }}
env: env:
RELEASE_TAG: ${{ github.event.release.tag_name }} RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_URL: ${{ github.event.release.html_url }} RELEASE_URL: ${{ github.event.release.html_url }}
@@ -117,6 +132,7 @@ jobs:
name: Notify Discord Release name: Notify Discord Release
needs: needs:
- prepare-release-notification - prepare-release-notification
if: ${{ needs.prepare-release-notification.outputs.available == 'true' }}
permissions: {} permissions: {}
uses: ./.github/workflows/notify-discord-release-notes.yml uses: ./.github/workflows/notify-discord-release-notes.yml
secrets: secrets: