-
Notifications
You must be signed in to change notification settings - Fork 5
fix X workflow trigger #138
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
Conversation
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.
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
releaseevent trigger toworkflow_runtrigger 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' }} |
Copilot
AI
Jan 24, 2026
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.
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' }}
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} |
| 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 |
Copilot
AI
Jan 24, 2026
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.
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.
| 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 != '' }} |
Use workflow_run trigger instead of release event