Skip to content

Conversation

@solidsnakedev
Copy link
Collaborator

Use workflow_run trigger instead of release event

Copilot AI review requested due to automatic review settings January 24, 2026 23:32
@solidsnakedev solidsnakedev merged commit 2a8bc8a into main Jan 24, 2026
8 checks passed
@solidsnakedev solidsnakedev deleted the fix/x-workflow-trigger branch January 24, 2026 23:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the X (Twitter) post-release notification workflow to use a workflow_run trigger instead of the release event, addressing potential timing or reliability issues with the previous approach.

Changes:

  • Switched from release event trigger to workflow_run trigger that listens for the "Release" workflow completion
  • Added a new step to fetch the latest release information via GitHub API instead of relying on event data
  • Updated the tweet message to use outputs from the API call instead of event context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jobs:
notify:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The conditional check will prevent this workflow from running when triggered via workflow_dispatch, since github.event.workflow_run will be null for manual triggers. Consider adding an additional condition to allow manual runs. For example: if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}

Suggested change
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}

Copilot uses AI. Check for mistakes.
Comment on lines +17 to 23
RELEASE=$(gh api /repos/${{ github.repository }}/releases/latest)
echo "tag=$(echo $RELEASE | jq -r .tag_name)" >> $GITHUB_OUTPUT
echo "url=$(echo $RELEASE | jq -r .html_url)" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Tweet new release
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

The workflow will trigger when the "Release" workflow completes, but the "Release" workflow has continue-on-error: true on the changesets action (release.yml:52). This means the post-release workflow could run even if no release was actually created. Consider adding error handling in the "Get latest release" step to handle cases where the API call fails, such as when no releases exist yet.

Suggested change
RELEASE=$(gh api /repos/${{ github.repository }}/releases/latest)
echo "tag=$(echo $RELEASE | jq -r .tag_name)" >> $GITHUB_OUTPUT
echo "url=$(echo $RELEASE | jq -r .html_url)" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tweet new release
if ! RELEASE=$(gh api /repos/${{ github.repository }}/releases/latest 2>/dev/null); then
echo "No GitHub release found; skipping notification."
echo "tag=" >> "$GITHUB_OUTPUT"
echo "url=" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "tag=$(echo "$RELEASE" | jq -r .tag_name)" >> "$GITHUB_OUTPUT"
echo "url=$(echo "$RELEASE" | jq -r .html_url)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tweet new release
if: ${{ steps.release.outputs.tag != '' }}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants