Skip to content
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

Action fails with "Not Found" when run in a merge queue #66

Open
twyatt opened this issue Dec 10, 2023 · 11 comments · May be fixed by #84
Open

Action fails with "Not Found" when run in a merge queue #66

twyatt opened this issue Dec 10, 2023 · 11 comments · May be fixed by #84

Comments

@twyatt
Copy link

twyatt commented Dec 10, 2023

To reproduce, created a sample project repo at: https:/JuulLabs/merge-queue-test

Without merge queue enabled, github-action-required-labels works (JuulLabs/merge-queue-test#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:/JuulLabs/merge-queue-test/actions/runs/7154600875/job/19482310003

When merge queue is enabled, and github-action-required-labels runs from the queue, it fails (JuulLabs/merge-queue-test#14) with:

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
Error: Not Found

https:/JuulLabs/merge-queue-test/actions/runs/7154628159/job/19482369364

@EugeneWImprint
Copy link

+1! The action seems to fail when in GitHub Merge-Queue

@mheap
Copy link
Owner

mheap commented Jun 15, 2024

Thanks both. I'll try to find some time to reproduce + fix

@mheap
Copy link
Owner

mheap commented Jun 16, 2024

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?

@twyatt
Copy link
Author

twyatt commented Jun 16, 2024

Is the issue that if you set label to be a required check for PR, it also becomes required for merge_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.

@mheap
Copy link
Owner

mheap commented Jun 19, 2024

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

@twyatt

This comment was marked as outdated.

@twyatt
Copy link
Author

twyatt commented Jul 16, 2024

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

If I'm understanding correctly, this did not work, unfortunately.

I tried with JuulLabs/merge-queue-test#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:

Screenshot 2024-07-15 at 11 43 27 PM

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?

@twyatt
Copy link
Author

twyatt commented Jul 16, 2024

I believe the github.ref context variable is available in a merge queue.
When I echoed it for JuulLabs/merge-queue-test#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?

@mheap mheap linked a pull request Sep 17, 2024 that will close this issue
@mheap
Copy link
Owner

mheap commented Sep 17, 2024

@twyatt I've given it a go. Can you test mheap/github-action-required-labels@merge-queue-support?

@twyatt
Copy link
Author

twyatt commented Sep 17, 2024

@twyatt I've given it a go. Can you test mheap/github-action-required-labels@merge-queue-support?

Awesome, TY!
I'll try to find some time soon to test it and report back.

@twyatt
Copy link
Author

twyatt commented Sep 20, 2024

I gave mheap/github-action-required-labels@merge-queue-support a try, sadly, I still got the "Not Found" error:

Run mheap/github-action-required-labels@merge-queue-support
  with:
    mode: exactly
    count: 1
    labels: patch, minor, major, maintenance, renovate
    token: ***
    message: Label error. Requires {{errorString}} {{count}} of: {{ provided }}. Found: {{ applied }}
    add_comment: false
    use_regex: false
/usr/bin/docker run --name d374d726b772f662246c0867d9716766ad730_43acc1 --label 3d374d --workdir /github/workspace --rm -e "INPUT_MODE" -e "INPUT_COUNT" -e "INPUT_LABELS" -e "INPUT_TOKEN" -e "INPUT_MESSAGE" -e "INPUT_ADD_COMMENT" -e "INPUT_EXIT_TYPE" -e "INPUT_USE_REGEX" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/<redacted>":"/github/workspace" 3d374d:726b772f662246c0867d9716766ad730
(node:1) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Not Found

Screenshot 2024-09-20 at 3 31 58 PM

Is there a way to enable additional logging, to get more details about what went wrong?

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 a pull request may close this issue.

3 participants