forked from siddharthvaddem/openscreen
-
Notifications
You must be signed in to change notification settings - Fork 76
ci(release): make the Discord announcement dispatchable on its own #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EtienneLescot
wants to merge
1
commit into
main
Choose a base branch
from
ci/announce-release-standalone
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.mjsexits with status0when 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