Skip to content

fix: checkout pull request head ref #24

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
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

suzuki-shunsuke
Copy link

@suzuki-shunsuke suzuki-shunsuke commented Mar 28, 2025

Close #23

index.ts Outdated
@@ -55,7 +55,7 @@ async function main() {
await exec("git", ["show", commit_hash]);
}
// Fetch and check out PR head
await exec("git", ["fetch", "--depth=1", "origin", `+refs/pull/${event.pull_request.number}/head`]);
await exec("git", ["fetch", "--depth=1", "origin", event.pull_request.head.ref]);
Copy link
Author

Choose a reason for hiding this comment

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

I found that probably this doesn't work in case of pull requests from fork repositories.

Copy link
Author

@suzuki-shunsuke suzuki-shunsuke Apr 27, 2025

Choose a reason for hiding this comment

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

989fe99 Checkout event.pull_request.head.sha instead of event.pull_request.head.ref.
https://github.com/actions/checkout?tab=readme-ov-file#Checkout-pull-request-HEAD-commit-instead-of-merge-commit

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.

autofix-ci/action failed due to fatal: couldn't find remote ref refs/pull/*/head
1 participant