fix: fetch fork PR heads in benchmark workflow#7763
Closed
RedZapdos123 wants to merge 1 commit into
Closed
Conversation
Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
f5ca43f to
f774023
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the /benchmark GitHub Actions workflow for fork-based pull requests by fetching the PR head from the PR’s actual head repository/ref (instead of assuming the branch exists on origin in tobymao/sqlglot).
Changes:
- Resolve PR head
clone_urlandrefvia the pull request API. - Fetch the PR head directly and check out
FETCH_HEADto run benchmarks on fork PRs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+27
to
+30
| PR_HEAD_REPO=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER" --jq '.head.repo.clone_url') | ||
| PR_HEAD_REF=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER" --jq '.head.ref') | ||
| git fetch "$PR_HEAD_REPO" "$PR_HEAD_REF" | ||
| git checkout FETCH_HEAD |
Collaborator
|
I don't want to risk getting this in given #7763 (comment). There is a |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description:
Issue #7762 reported that the benchmark workflow fails for fork pull requests because it resolves the PR head ref and then tries to fetch that branch from
origin, which only contains branches fromtobymao/sqlglot.This PR updates
.github/workflows/benchmark-sqlglot.ymlto resolve the PR head repository clone URL and head ref from the pull request API, then fetches that ref directly and checks outFETCH_HEAD.This keeps the workflow behavior the same for same-repository pull requests and fixes the checkout path for fork pull requests.
Closes #7762.
Checklist:
git fetch origin "$PR_HEAD"failing for PR clickhouse: parse documented SHOW and EXPLAIN statements #7670.FETCH_HEADsuccessfully.make check.