-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Replace baseRefName with headRefName #103
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you share a repo or order of events that you think is bugged? I don't think what you're proposing is what I originally wanted to do with this action
baseRefName, | ||
owner: github.context.repo.owner, | ||
repo: github.context.repo.repo, | ||
headRefName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query is for getting all PRs targetting the same branch. But head is the branch of the PR, no? I want the common base of the branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseRefName
is dev
in my case, the "head" that all my PRs are branched off of. headRefName
is actually the branch of the PR. You can see that here:
Repo from my screenshots & testing is a private one. I can try to set you up with a public one.
But what I can tell you is that by merging the branch with the new action into dev
, and pushing code to dev
, the action was triggered on all PRs that were based off of dev
and thus have been labeled. And I did check each to confirm there actually are conflicts.
Was this your intended behavior?
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Thanks for your work on this GH Action - Its going to be great for visibility for my team. I tried using the action with this setup:
However, it wasn't working at all. Using the debug logs, it was returning an empty array response for the query. I used the Github graphql explorer to debug.
What I ended up finding is that the
getBranchName
query used to populate thebaseRefName
in the query was seemingly the issue.baseRefName
for my case when I have a PR branched off ofdev
(long standing environment branch - similar tomain/master
), thebaseRefName
of that PR would actually bedev
.headRefName
in my findings actually was the branch name. It seems that the intention of the query, based on the function namegetBranchName
, was to filter the query by the actual branch name (headRefName
) not thebaseRefName
which seems to the be branch name that this PR is branched off.So when I changed the query, my results returned the PR I expected, and thus the gh action was successful.
Here's some screenshots to back it up:
(before my work)
Screenshot showing the
baseRefName
as printed by the action debug logs:Screenshot of using that in the query, as your action uses. Notice the empty results:
(After my work)
Screenshot of using the query filter
headRefName
instead:Screenshot of gh actions response logs with this change:
Proof of it working!
As it seems, there was a mixup in the
baseRefName
andheadRefName
var. Please let me know if you have any questions!Anyone reading can use my version of the gh action until this PR is merged. I will keep it up!
tannerhallman/actions-label-merge-conflict@main