auto-assign-action icon indicating copy to clipboard operation
auto-assign-action copied to clipboard

Github token permissions

Open atmafox opened this issue 4 years ago • 4 comments

What github token permissions are necessary?

atmafox avatar Nov 10 '19 18:11 atmafox

@atmafox This action uses permissions for issues and pull requests.

Refer to the following link for details.

https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token

kentaro-m avatar Nov 11 '19 00:11 kentaro-m

I need a special token to run this action on forked PRs then? How can I set to the action? I'm seeing this error in my check:

##[warning]Resource not accessible by integration

And the action is not failing, but no reviewers are being added.

EDIT: maybe adding a section in the docs about this topic? :p

ricardozanini avatar Jul 07 '20 12:07 ricardozanini

permissions needed:

permissions:
  contents: read
  pull-requests: write

https://github.com/kentaro-m/auto-assign-action/issues/136#issuecomment-1619235502

electrovir avatar Aug 17 '23 16:08 electrovir

Need to grant permissions for the actions workflow:

My environment is based on Github Actions Runner on EKS and Github Enterprise Server(self-hosted) v3.10.2.

Example use-case

Currently located in the root path of the repo where you want to apply PR Auto-assign.

$ tree .github/
.github/
├── auto-assign.yml
└── workflows
    └── pr-reviewer-auto-assign.yml
# .github/workflows/pr-reviewer-auto-assign.yml
name: Auto Assign Action
on:
  - pull_request_target

permissions:
  contents: read
  pull-requests: write
  
jobs:
  add-reviews:
    runs-on: [self-hosted, linux]
    steps:
      - uses: actions/[email protected]
        with:
          configuration-path: ".github/auto-assign.yml"

Enter the Github usernames you want to assign as a PR Reviewer in reviewers.

# .github/auto-assign.yml
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
#addAssignees: true

# Set addAssignees to 'author' to set the PR creator as the assignee.
addAssignees: author

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers: 
  - github-alice
  - github-bob
  - github-carol

# A list of keywords to be skipped the process that add reviewers if pull requests include it 
#skipKeywords:
#  - wip

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0

runOnDraft: true

younsl avatar Oct 24 '23 10:10 younsl