-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Actions: pull_request event checks out PR head, not merge commit #27039
Comments
@Zettat123 Could you have a look at this? |
Thanks for the bug report. The reason of this bug is Gitea doesn't have
There has been a proposal(#13134) to add this kind of reference. This bug can only be fixed when Gitea supports such a reference. I'll update the documentation later to explain this difference between Gitea Actions and Github Actions. |
Thank you. That's a pity, as it also increases the conceptual distance between Gitea and Github CICD at a pretty base level. If indeed
#13134 does not sound like a complicated enhancement? |
The However, in Gitea, the commit id in the pull_request table is the actual commit id and the id can only be set after the head branch is actually merged into the base branch. So we cannot get the id before the PR is merged. |
I'm not sure I get the distinction between "hypothetical" and "actual" here -- I'd think that Github actually does the PR merge in the background (maybe as part of the merge conflict checking?), because how else would it be able to derive a correct |
Related to #27039 The `ref` property in Gitea Actions is different from GitHub Actions. This PR improves the documentation to explain the difference.
Related to go-gitea#27039 The `ref` property in Gitea Actions is different from GitHub Actions. This PR improves the documentation to explain the difference.
Backport #27126 by @Zettat123 Related to #27039 The `ref` property in Gitea Actions is different from GitHub Actions. This PR improves the documentation to explain the difference. Co-authored-by: Zettat123 <zettat123@gmail.com>
Sorry for the ambiguity. I use "hypothetical" here simply because the head branch of the PR is not actually merged into the base branch. From the documentation, we can find
I'm not sure how it is implemented, but I think Gitea should be able to do the same thing in theory. |
Description
tl;dr: When using a CI configuration set up with
on: pull_request
, this fires on PR updates, but checks out not the merge commit, but the PR HEAD.This is unexpected, because
Observed behaviour
As documented, Gitea Actions implement the
pull_request
workflow trigger event, and it is "compatible with Github".Githubs docs, linked from the above page, say that
GITHUB_SHA
will be the "Last merge commit on the GITHUB_REF branch" andGITHUB_REF
will be the "PR merge branch refs/pull/:prNumber/merge".I have a workflow configured with
and use
actions/checkout@v3
.On a pull request update, in the "Set up job" log of the Workflow run, I unexpectedly see "GITHUB_REF:refs/pull/61/head" and a GITHUB_SHA entry that corresponds to the PR HEAD (i.e. the last pushed commit), and not the merge commit, as documented.
Expected behaviour
A
pull_request
event builds the merge commit of the PR commit that triggered the event, or some other way to continuously build the integrated branch. Otherwise a PR could test green, but break the tests after merging.Gitea Version
1.20.3
Can you reproduce the bug on the Gitea demo site?
Could not check
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
This is a self-hosted instance, but I'm not running it so I can't offer more details.
Database
None
The text was updated successfully, but these errors were encountered: