Code Monkey home page Code Monkey logo

Comments (9)

peter-evans avatar peter-evans commented on July 20, 2024 16

So it seems to be permissions related, but Iā€™m not sure if it's intentional. It might be a GitHub API bug. The problem seems to be that the default GITHUB_TOKEN does not have permission to request a review from a team. It doesn't appear to matter whether the repository is private or not, or whether the team is nested or not.

Here is how you can work around it:

  1. Create a new GitHub account that will act as a machine user.
  2. Add the machine user to a team that has write access for the repository.
  3. Log into the machine user account and create a repo scoped PAT.
  4. Copy the generated PAT to a secret in your repository.
  5. Use the secret instead of the default GITHUB_TOKEN when running create-pull-request action.

from create-pull-request.

peter-evans avatar peter-evans commented on July 20, 2024 1

Hi @jchoksijudopay

This looks like a permissions issue. Could you explain a bit more about your setup. Is the team in the same org as the repository? Does the team have collaborator (write) access to the repository? Is the repository private?

from create-pull-request.

jchoksijudopay avatar jchoksijudopay commented on July 20, 2024

Is the team in the same org as the repository?

Yes it is.

Does the team have collaborator (write) access to the repository?

Yes the developers team has Write role access to the repository.

We have a Nested Team structure as follows:

- WriteAccess Team (is the team that is assigned the "Write" Role to the repository)
  |--- CI Team
       |--- CI Member 1
       |--- CI Member 2
       |--- CI Member n
  |--- Developers Team
       |--- Developer Member 1
       |--- Developer Member 2
       |--- Developer Member n

Is the repository private?

Yes it is private.

from create-pull-request.

peter-evans avatar peter-evans commented on July 20, 2024

I'll try and find some time to reproduce the problem and see if I can find a workaround. I'm fairly sure this is not a problem with the action itself, it's likely to be a permissions related issue with the GitHub API. One thing you could try is using a PAT instead of the default GITHUB_TOKEN. You could also experiment with a top-level (not nested) team to see if that makes a difference.

from create-pull-request.

peter-evans avatar peter-evans commented on July 20, 2024

I managed to setup an org and teams in the same way and reproduced the error. I'll see if I can figure out what the issue is and any workaround.

from create-pull-request.

jchoksijudopay avatar jchoksijudopay commented on July 20, 2024

Sorry for the delay in providing feedback. Using a PAT as a workaround works for us. Thank you very much for looking into the matter.

from create-pull-request.

thulasidassrinivasan avatar thulasidassrinivasan commented on July 20, 2024

@peter-evans - I am facing the same issue even if I use PAT token.

Below fails
- name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.user_GITHUB_TOKEN }} branch: update-flux branch-suffix: short-commit-hash commit-message: Update to ${{ steps.update.outputs.flux_version }} title: Update to ${{ steps.update.outputs.flux_version }} body: | ${{ steps.update.outputs.flux_version }} delete-branch: true author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> team-reviewers: | admin

Below works
- name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.user_GITHUB_TOKEN }} branch: update-flux branch-suffix: short-commit-hash commit-message: Update to ${{ steps.update.outputs.flux_version }} title: Update to ${{ steps.update.outputs.flux_version }} body: | ${{ steps.update.outputs.flux_version }} delete-branch: true author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> reviewers: thulasidassrinivasan

What am I doing wrong ? Could you Please help?

from create-pull-request.

loujr avatar loujr commented on July 20, 2024

Was able to reproduce the following error using a GitHub App for this endpoint - the issue is permissions.

{
  "message": "Validation Failed",
  "errors": [
    "Could not resolve to a node with the global id of 'T_kwDOBnBNDs4AYoNE'."
  ],
  "documentation_url": "https://docs.github.com/rest/reference/pulls#request-reviewers-for-a-pull-request"
}

For this endpoint to be successful the following permissions must be enabled on GitHub Apps:

Read access to metadata
Read and write access to members, pull requests, and team discussions

from create-pull-request.

shivajipotnuru avatar shivajipotnuru commented on July 20, 2024

I'm also facing the same issue with my new GitHub app,

I have given the required permissions for the app, but still I'm getting this error.

@loujr please let me know , if you are able to fix this issue?

from create-pull-request.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.