Replies: 1 comment
-
|
@MrHinsh did you solve this anyway? My understanding is that this is fundamentally driven by the GITHUB_REF environment variable when building in a GHA agent. I don't think its possible to override this variable in GHA, and I don't know if its possible to override it any other way... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a public repo, and in order to build with secrets I just switched to
pull_request_targetand GitVersion thinks its on main! (it also jumped a major version, which I don't know why).Id appreciate any help from someone that has already tried this!
Here’s a table that illustrates the difference in behavior of
GitVersion_BranchNamewhen usingpull_requestvs.pull_request_targetin GitHub Actions.GitVersion_BranchNameOutput Examplepull_requestpull/2439/mergepull_request, GitHub Actions runs in the context of the PR branch, hence the branch name will be formatted aspull/{PR number}/merge.pull_request_targetmainpull_request_target, GitHub Actions runs in the context of the base branch (e.g.,main), not the PR branch. Therefore,GitVersion_BranchNamewill be set tomain.Key Differences:
pull_request: The workflow runs in the context of the pull request (head) branch, andGitVersion_BranchNamewill be formatted withpull/{PR number}/merge.pull_request_target: The workflow runs in the context of the base branch (the branch being targeted by the PR), andGitVersion_BranchNamereflects the base branch name, such asmain.This behavior is due to the fact that
pull_request_targetuses the base branch’s context (which allows access to secrets), whilepull_requestuses the context of the pull request’s head branch.Triggers:
workflow:
Gitversion.yaml
Beta Was this translation helpful? Give feedback.
All reactions