-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ci: Fix GitHub Actions Workflow Status Fetching and Update Output Handling #23103
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe pull request modifies the GitHub Actions workflow configuration in the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
🔇 Additional comments (2).github/actions/last-workflow-status/action.yaml (2)
The change correctly implements the new output syntax, replacing the deprecated
The Let's verify the workflow triggers and potential impact: Consider adding a fallback to -"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_ID }}/runs?per_page=1&status=completed&branch=${{ github.head_ref }}" \
+"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_ID }}/runs?per_page=1&status=completed&branch=${{ github.head_ref || github.ref_name }}" \ ✅ Verification successfulLet me generate another verification script to check the workflow usage: The action is used only in simulation workflows triggered by schedule and release events Based on the verification results, the
Since these workflows don't use pull request events, using 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check workflow triggers and potential empty head_ref scenarios
# Check workflow files that might trigger this action
rg -l "uses: .*/last-workflow-status" -g "*.yml" -g "*.yaml"
# Check for non-PR event triggers in those workflows
rg "on:|workflow_dispatch:|push:|schedule:" -A 5 -g "*.yml" -g "*.yaml"
Length of output: 96970 Script: #!/bin/bash
# Check workflow files for usage of last-workflow-status action and their triggers
rg -l "uses: .*last-workflow-status" .github/workflows/
rg "on:|pull_request:|push:|workflow_dispatch:" -A 5 .github/workflows/
Length of output: 77955 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Description
Closes: #XXXX
This PR modifies the script for retrieving and storing the status of the last completed GitHub Actions workflow. The key changes include:
Updated the API endpoint for fetching the workflow runs to correctly use github.head_ref instead of env.GITHUB_HEAD_REF. This ensures the correct branch reference is used in the API request.
Replaced the deprecated set-output command with direct writing to $GITHUB_OUTPUT. This change aligns with the updated GitHub Actions practices for output handling.
Critical lines updated:
Original:
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_ID }}/runs?per_page=1&status=completed&branch=${{ env.GITHUB_HEAD_REF }}" \
Modified:
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_ID }}/runs?per_page=1&status=completed&branch=${{ github.head_ref }}" \
Original:
echo "::set-output name=last_status::${last_status}"
Modified:
echo "last_status=${last_status}" >> $GITHUB_OUTPUT
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit