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

Improve the error message when an invalid assignee is used in pr create #3224

Open
yi-Xu-0100 opened this issue Mar 14, 2021 · 9 comments
Open
Labels
bug Something isn't working gh-pr relating to the gh pr command p3 Affects a small number of users or is largely cosmetic

Comments

@yi-Xu-0100
Copy link

Describe the bug

GraphQL error: Could not resolve to a User with the login of 'github-actions[bot]'.

Steps to reproduce the behavior

I try to use the actions to make a PR. But I don' t know how to set the git user.

Expected vs actual behavior

Create the pr successfully.

Logs

https://github.com/yi-Xu-0100/test/runs/2106162302 Use the different user, But it also got the same error.

@yi-Xu-0100 yi-Xu-0100 added the bug Something isn't working label Mar 14, 2021
@mislav
Copy link
Contributor

mislav commented Mar 15, 2021

Hi, could you link us to the exact code that uses GitHub CLI which results in the error you're seeing?

I'm looking at this workflow file but I can't see where GitHub CLI is being used. Thank you

@yi-Xu-0100
Copy link
Author

yi-Xu-0100 commented Mar 15, 2021

@mislav about the gh pr, I test many times. You can see the file and result.

  1. file: https://github.com/yi-Xu-0100/test/actions/runs/651166537/workflow, result: https://github.com/yi-Xu-0100/test/runs/2106132028
  2. file: https://github.com/yi-Xu-0100/test/actions/runs/651182429/workflow, result: https://github.com/yi-Xu-0100/test/runs/2106162302

I look forward to your reply, I think gh should be more elegant than curl. 😀

@yi-Xu-0100
Copy link
Author

The way to find the workflow file about the workflow.
image
image

@mislav
Copy link
Contributor

mislav commented Mar 15, 2021

@yi-Xu-0100 Thanks! I see now that you've used this flag for pr create: -a '@me'

This won't work, as the bot user github-actions is not a valid assignee for issues or PRs. If there should be an assignee for the new PR, it should be a username of a regular GitHub user.

Perhaps we need a better error message in this case.

@yi-Xu-0100
Copy link
Author

yi-Xu-0100 commented Mar 15, 2021

@mislav Thanks, I think I know how to modify it. If you don’t need to track this issue, just close it without telling me. 😊

@mislav mislav added p3 Affects a small number of users or is largely cosmetic and removed needs-user-input labels Mar 15, 2021
@mislav mislav changed the title GraphQL error: Could not resolve to a User with the login of 'github-actions[bot]'. Improve the error message when an invalid assignee is used in pr create Mar 15, 2021
@SONVICHETH

This comment has been minimized.

@yi-Xu-0100
Copy link
Author

yi-Xu-0100 commented Mar 16, 2021

file: https://github.com/yi-Xu-0100/test/actions/runs/651182429/workflow, result: https://github.com/yi-Xu-0100/test/runs/2106162302

@mislav I have a little confused about the above test, in which I change the config username before using gh pr. But it still has the same error about the username of github-actions[bit]. I think the auth could be changed by changing the username, Why it did not happen?

@mislav
Copy link
Contributor

mislav commented Mar 16, 2021

I think the auth could be changed by changing the username, Why it did not happen?

No, GitHub CLI does not respect git's user.name or user.email config options at all. These options are only used in git operations like git commit. You cannot change which user GitHub CLI authenticates as by changing a config option.

When GitHub CLI creates an object, for example a new pull request, that object will be owned by whoever owns the GITHUB_TOKEN. In the case of GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}, the authenticating user is the github-actions bot. If you want it to be someone else, that account will have to generate a personal access token, you should add that new token to the secrets in this repository, and then use it instead of the default secrets.GITHUB_TOKEN.

@yi-Xu-0100
Copy link
Author

@mislav Thank you very much for your detailed explanation!

@samcoe samcoe added the gh-pr relating to the gh pr command label Oct 2, 2023
ringods added a commit to pulumiverse/pulumi-grafana that referenced this issue Apr 15, 2024
ringods added a commit to pulumiverse/pulumi-scaleway that referenced this issue Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gh-pr relating to the gh pr command p3 Affects a small number of users or is largely cosmetic
Projects
None yet
Development

No branches or pull requests

5 participants
@mislav @samcoe @yi-Xu-0100 @SONVICHETH and others