Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/announce-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Announcing a release lived only inside prerelease.yml and promote.yml, as the
# last step of each. Both promotions so far failed before reaching it — v1.8.0 on
# a merge conflict, v1.9.0 on a non-rebasable sync branch — and each time the
# announcement was silently skipped along with everything downstream of the
# failure, with no way to send it afterwards short of re-running the whole
# promotion over an already-tagged release.
#
# This exposes the same script on its own, so a missed announcement is a dispatch
# rather than a recovery operation. It reads nothing but the tag and the matching
# milestone, so it produces the identical message whenever it runs.
name: Announce a release on Discord

on:
workflow_dispatch:
inputs:
tag:
description: "Release tag to announce (e.g. v1.9.0)"
required: true
type: string
kind:
description: "stable posts to the release channel, rc to the testing channel"
required: true
type: choice
options: [stable, rc]
default: stable
release_notes_extra:
description: "Optional message prepended to the announcement"
required: false
type: string
default: ""

permissions:
contents: read

jobs:
announce:
name: Announce ${{ inputs.tag }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: ./.github/actions/setup

- name: Announce on Discord
env:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
# The script prefers the RC channel whenever that variable is non-empty,
# so exactly one of these may be set — blanking the other is what selects
# the destination, not the KIND value.
DISCORD_RELEASE_CHANNEL_ID: ${{ inputs.kind == 'stable' && vars.DISCORD_RELEASE_CHANNEL_ID || '' }}
DISCORD_RC_TESTING_CHANNEL_ID: ${{ inputs.kind == 'rc' && vars.DISCORD_RC_TESTING_CHANNEL_ID || '' }}
# Only used to list the closed issues of the matching milestone; the
# announcement still posts without it, just without that section.
GITHUB_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
STABLE_TAG: ${{ inputs.tag }}
EXTRA: ${{ inputs.release_notes_extra }}
KIND: ${{ inputs.kind }}
run: node .github/scripts/discord-release-announce.mjs

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fail the job when the announcement is not sent.

.github/scripts/discord-release-announce.mjs exits with status 0 when Discord configuration is missing, the channel lookup fails, or the post fails. This workflow then reports success although it sent no announcement. That recreates the silent failure that this workflow is intended to recover from.

Add a strict mode for manual announcements. In strict mode, make missing configuration and Discord API failures exit non-zero.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/announce-release.yml at line 60, Update the announcement
script invocation in the workflow and the corresponding logic in
discord-release-announce.mjs to support strict mode for manual announcements.
Enable strict mode from announce-release.yml, and ensure missing Discord
configuration, channel lookup failures, and post failures exit with a non-zero
status while preserving current behavior when strict mode is not enabled.

Loading