Open twyatt opened 7 months ago
+1! The action seems to fail when in GitHub Merge-Queue
Thanks both. I'll try to find some time to reproduce + fix
Alright, I've managed to reproduce (merge queues are not easy if you've not used them before).
The issue is that the merge_queue
event does not contain any context from the PR that was being merged. That means when we try to fetch the applied labels via the API it returns a 404 as there's no PR number available.
It looks as though a failing pull_request
check will cause the PR not to be added to a merge queue. Is the issue that if you set label
to be a required check for PR, it also becomes required for merge_queue
?
Is the issue that if you set
label
to be a required check for PR, it also becomes required formerge_queue
?
It has been a while since I have given merged queues a try, but that is my recollection.
From what I remember, we were using label
as a required check for PR merges and wanted to leverage merge queues. When enabling merge queues, label
check began failing, blocking any ability to merge PRs with merge queues. We ultimately valued having a label check over being able to use merge queues, so we abandoned the merge queues feature in the hopes that the two would one day play nice together.
It should work if you keep the label check on pull_request
and split the merge_queue
workflow in to a separate file. This would allow you to use the action with merge queues as it will only run on pull_request
events
It should work if you keep the label check on
pull_request
and split themerge_queue
workflow in to a separate file.
Thanks for the tips! I'll give it a try soon.
It should work if you keep the label check on
pull_request
and split themerge_queue
workflow in to a separate file. This would allow you to use the action with merge queues as it will only run onpull_request
events
If I'm understanding correctly, this did not work, unfortunately.
I tried with https://github.com/JuulLabs/merge-queue-test/pull/16, whereas I removed merge_group
from the labels check, but in doing so: the merge queue never allows the PR to run in the merge queue:
It seems I'd have to remove the label check as a required check for merging to main
, but I do want to make sure labels are assigned to PRs; so I'm not sure what the best option would be here?
I believe the github.ref
context variable is available in a merge queue.
When I echo
ed it for https://github.com/JuulLabs/merge-queue-test/pull/17, github.ref
evaluated to:
refs/heads/gh-readonly-queue/main/pr-17-a3c310584587d4b97c2df0cb46fe050cc46a15d6
Perhaps a bit clunky, but couldn't the PR number be parsed out of that variable?
To reproduce, created a sample project repo at: https://github.com/JuulLabs/merge-queue-test
Without merge queue enabled,
github-action-required-labels
works (https://github.com/JuulLabs/merge-queue-test/pull/13) as expected:GitHub Action run w/o merge queue
``` Run mheap/github-action-required-labels@v5 with: mode: exactly count: 1 labels: patch, minor, major, maintenance token: *** message: Label error. Requires {{errorString}} {{count}} of: {{ provided }}. Found: {{ applied }} add_comment: false ``` — https://github.com/JuulLabs/merge-queue-test/actions/runs/7154600875/job/19482310003When merge queue is enabled, and
github-action-required-labels
runs from the queue, it fails (https://github.com/JuulLabs/merge-queue-test/pull/14) with:— https://github.com/JuulLabs/merge-queue-test/actions/runs/7154628159/job/19482369364