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

422: Validation Failed while using manual approval task in GitHub actions #7

Closed
saikrishna-snp opened this issue May 17, 2022 · 19 comments · Fixed by #27
Closed

422: Validation Failed while using manual approval task in GitHub actions #7

saikrishna-snp opened this issue May 17, 2022 · 19 comments · Fixed by #27

Comments

@saikrishna-snp
Copy link

I am getting 422 validation failed error while manual-approval task is getting executed as part of my workflow. This is not happening on my personal organizational repository.

Here's the error from workflow execution:

/usr/bin/docker run --name ghcriotrstringermanualapproval120_1e2292 --label 08450d --workdir /github/workspace --rm -e pat_token -e INPUT_SECRET -e INPUT_APPROVERS -e INPUT_MINIMUM-APPROVALS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_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_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 RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_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/xxxxxxxxxxx":"/github/workspace" ghcr.io/trstringer/manual-approval:1.2.0
Required approvers: saikrishna-snp, apeechara-nacha
error creating issue: POST https://api.github.com/repos/xxxxxxx/xxxxxxxx/issues: 422 Validation Failed [{Resource:Issue Field:assignees Code:invalid Message:}]

@trstringer
Copy link
Owner

Thanks for opening this issue! Is the target repository and corresponding workflow run public?

@saikrishna-snp
Copy link
Author

They are private

@trstringer
Copy link
Owner

Does this consistently happen with the same repo? Or does it not happen every time the workflow runs? Are you able to repro this outside of this repro? Also, what runner are you using? A GitHub-hosted runner or self-hosted?

@saikrishna-snp
Copy link
Author

It never worked in the client's organizational repository, but the same is working under my repository (the entire workflow). We are using a Github-hosted runner with Ubuntu as the operating system.

@trstringer
Copy link
Owner

Ok thanks for the info. I'll try to repro this in an org repo.

@saikrishna-snp
Copy link
Author

@trstringer Any update on this issue?

@trstringer
Copy link
Owner

I was unable to repro this in a private org repo. What are the repo settings for actions? In the repo, go to Settings -> Actions -> General. Can you tell me the selections for the following?

  • Actions permissions (options are allow all actions, disable actions, allow org actions, allow org and select actions)
  • Workflow permissions (options are read/write, or read only)

I don't think it's workflow permissions, though, because if I set that to read only I get a failure but the HTTP response code is 403, not 422.

@trstringer
Copy link
Owner

I just created a new release (v1.3.0) which includes debug logging for issue creation. Can you rerun this action? You should now see some important output (such as issue body and title) that can help further debug this problem. Can you run that and share the output (redacting any sensitive data)?

@saikrishna-snp
Copy link
Author

@trstringer Here's the screenshot for actions and workflow permissions.
image

We ran the pipeline again and the issue is still the same but with more information as you said. Here are the logs from the task in actions workflow:

/usr/bin/docker run --name ghcriotrstringermanualapproval140_07cc16 --label 08450d --workdir /github/workspace --rm -e pat_token -e INPUT_SECRET -e INPUT_APPROVERS -e INPUT_MINIMUM-APPROVALS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_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_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 RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_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/xxxxxxxxxxxxxxxx":"/github/workspace" ghcr.io/trstringer/manual-approval:1.4.0
Required approvers: saikrishna-snp, apeechara-nacha
Creating issue in repo xxxxxxxxxxxxxxxxxxxxxxx with the following content:
Title: Manual approval required for workflow run 2392744066
Approvers: [saikrishna-snp apeechara-nacha]
Body:
Workflow is pending manual review.
URL: https://github.com/xxxxxxxxxxxxxx/actions/runs/2392744066

Required approvers: [saikrishna-snp apeechara-nacha]

Respond "approved", "approve", "lgtm", "yes" to continue workflow or "denied", "deny", "no" to cancel.
error creating issue: POST https://api.github.com/repos/xxxxxxxxxxxxxxx/issues: 422 Validation Failed [{Resource:Issue Field:assignees Code:invalid Message:}]

@trstringer
Copy link
Owner

Did you copy/paste that directly? Can you validate that? The Title seems very wrong. Here's what the raw text looks like:

Title: Manual approval required for workflow run 23[9](https://github.com/xxxxxxxxxxxxxxxxxx/runs/6615546564?check_suite_focus=true#step:3:10)2744066

Can you confirm that is the actual Title text in the logs and not just a copy/paste error? I understand some of it was redacted (with "xxxxxxx") but is there really the square brackets and parenthesis with an URL in it?

@saikrishna-snp
Copy link
Author

It's a copy/paste error. here's the title from Raw logs

Title: Manual approval required for workflow run 2392744066

@saikrishna-snp
Copy link
Author

@trstringer Any insights on this issue?

@jniltinho
Copy link

  • Add users in project

422 Validation Failed [{Resource:Issue Field:assignees Code:invalid Message:}]

@trstringer
Copy link
Owner

@jniltinho, are you getting this same error? If so, can you share the log output from the action?

@saikrishna-snp, I think now the next step is for me to add a form of debug logging so that we can get additional information on this request.

@jniltinho
Copy link

are you getting this same error? If so, can you share the log output from the action?

Yes,

I was getting the same error, as I have more users in the project, but they weren't participating in the project, I just put it for my user who owns the repo, that way it worked.
Then I added the users in the project and added all the approvers, it worked perfectly, Fix error 422.
Just add users to the project.

image

@trstringer
Copy link
Owner

Ah great!! Thank you for the fix! I'll get this documented in this project. @saikrishna-snp, can you take a look at @jniltinho's fix above and see if that works for you?

@jniltinho
Copy link

@trstringer
Copy link
Owner

@jniltinho, thank you!!!

@jniltinho
Copy link

@trstringer I love Golang,

I will fork your project so I learn more and can in the future send my PRs for the project!!!

trstringer added a commit that referenced this issue Jun 30, 2022
If a required approver does not have the ability to be an approver in
the repository then when running this action you could receive an
HTTP/402 Validation Failed error. This change documents this behavior.
Closes #7.
trstringer added a commit that referenced this issue Jun 30, 2022
If a required approver does not have the ability to be an approver in
the repository then when running this action you could receive an
HTTP/402 Validation Failed error. This change documents this behavior.
Closes #7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants