Skip to content

Conversation

@bryangingechen
Copy link
Contributor

Proposed changes

This change will allow the action to properly find the PR when it is triggered via pull_request or pull_request_target from a PR from a fork, by calling the API endpoint corresponding to the repo at the head of the PR, rather than the base repo.

Fixes #326.

Types of changes

What types of changes does your code introduce ?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@bryangingechen
Copy link
Contributor Author

Not sure what I've done wrong since the failing log is empty for me.

Comment on lines 19 to 21
const commit_sha = triggeredFromPR
? github.context.payload.pull_request?.head.sha
: sha
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out we need the logic from #329 after all, since otherwise sha comes from the merge commit and then the PR can't be found; cf. this log where sha is 58af011, but the actual head commit is 1f1d959.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I just noticed that this is incorrect since it overrides the user input in sha.

Copy link
Owner

Choose a reason for hiding this comment

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

What prevents us from just kicking the const commit_sha out of here and using always the sha from the function argument?
Then we don't need to base this on the #329 at all, since all you need is use the current workaround, for providing the sha per config manually, but the rest (owner and repo) will be working for forked and not-forked PRs?

Or what am I overlooking?

Copy link
Contributor Author

@bryangingechen bryangingechen Jul 2, 2025

Choose a reason for hiding this comment

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

Ah, that's what I had in 9a8fcfc, but it was failing CI since the "build / clean-run (pull_request)" job doesn't pass on the correct sha. I guess if you prefer, I can re-open this and also add the workaround to the CI job? It just seemed simpler to go with #329 first (e.g. would you want to revert the CI change after that's merged?), but either way works for me.

edit: I've gone ahead and done the above.

@bryangingechen
Copy link
Contributor Author

Per the above comments, I don't see a clean way to implement this without #329, so I'm going to close this and then rebase / reopen after that is merged.

@bryangingechen bryangingechen reopened this Jul 3, 2025
@8BitJonny 8BitJonny merged commit 1da3c94 into 8BitJonny:master Sep 6, 2025
11 checks passed
@8BitJonny 8BitJonny mentioned this pull request Sep 6, 2025
@bryangingechen bryangingechen deleted the works-for-forks branch September 6, 2025 23:39
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.

finding PRs from forks

2 participants