kentaro-m / auto-assign-action Goto Github PK
View Code? Open in Web Editor NEWAn action which adds reviewers to the pull request when the pull request is opened.
License: MIT License
An action which adds reviewers to the pull request when the pull request is opened.
License: MIT License
I have the config as presented below. The action is adding the author but does not adds me as a reviewer.
addReviewers: true
addAssignees: author
reviewers:
- Power-Maverick
numberOfReviewers: 0
How can I add a workflow which auto assigns PRs to a team?
Assuming the following configuration, I'd expect that only one reviewer would be selected given that numberOfReviwers
is set to 1, instead, it returns 3 values: user1, user2, and a user in the charlie group.
addReviewers: true
numberOfReviewers: 1
useReviewGroups: true
reviewGroups:
alpha:
- user1
bravo:
- user2
charlie:
- user3
- user4
- user5
I believe either the name of the configuration numberOfReviwers
is misleading when useReviewGroups
is enabled, or there's a bug where it assigns more than one reviewer to the PR.
I can work on a PR to fix the problem, I just need to know which approach you guys think it's the best. Personally, I think numberOfReviewers
should always be respected regardless of the number of developers each group has. I'd also include a configuration to the group, so it can select one or multiple developers per group to be used later by the numberOfReviewers
variable.
What github token permissions are necessary?
name: On Open PR Actions
on:
pull_request:
# types: [opened]
jobs:
auto-assign:
permissions: write-all
runs-on: self-hosted
steps:
- name: Auto Assign Action
uses: kentaro-m/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
I keep getting Bad Credentials error despite of token having write permissions. What am I missing?
GITHUB_TOKEN Permissions
Actions: write
Checks: write
Contents: write
Deployments: write
Discussions: write
Issues: write
Metadata: read
Packages: write
Pages: write
PullRequests: write
RepositoryProjects: write
SecurityEvents: write
Statuses: write
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Error: Bad credentials
I use this workflow at my repo:
.github
├── auto_assign.yml
└── workflows
└── pre_cr.yml
auto_assign.yml:
# Set to true to add reviewers to pull requests
addReviewers: true
# Set to true to add assignees to pull requests
addAssignees: author
# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- A
- B
# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0
# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- WIP
- wip
pre_cr.yml:
name: 'Pre-CR | Assign Reviewer'
on: pull_request
jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/auto-assign-action@v1
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
I received an error during the job setting up:
Current runner version: '2.160.2'
Prepare workflow directory
Prepare all required actions
Download action repository 'kentaro-m/auto-assign-action@v1'
##[warning]Failed to download action 'https://api.github.com/repos/kentaro-m/auto-assign-action/tarball/v1'. Error Response status code does not indicate success: 404 (Not Found).
##[warning]Back off 21.548 seconds before retry.
##[warning]Failed to download action 'https://api.github.com/repos/kentaro-m/auto-assign-action/tarball/v1'. Error Response status code does not indicate success: 404 (Not Found).
##[warning]Back off 14.766 seconds before retry.
##[error]Response status code does not indicate success: 404 (Not Found).
Did I miss something? Thanks for helping in advance.
solved by changing v1 to v1.0.1
As Github does, it will be beneficial to assign a person who has authored the code before the PR.
Also, a person who is never involved with the code.
Note: If everyone is already involved with the code, then the action can also randomly choose people.
There should be a configuration setting to override the default behavior which skips draft PRs.
In my case, I'd like the github action to assign the author regardless if it's a draft/non-draft PR.
Hello 👋
Not sure if this is a feature of this action, but is it possible to auto-assign reviewers based on a specific label?
Example, if the label backend
is applied only reviewers from the backend group would be assigned to the PR. Same for the frontend
label.
# Set to true to add reviewers from different groups to pull requests
useReviewGroups: true
# A list of reviewers, split into different groups, to be added to pull requests (GitHub user name)
reviewGroups:
backend:
- reviewerA
- reviewerB
- reviewerC
frontend:
- reviewerD
- reviewerE
- reviewerF
-
filterLabels:
include:
- backend
- frontend
# Not run
exclude:
- wip
Thank you.
4 developers work on a single repo. If one developer creates a PR, and he is in the "reviewers" list, action fails with "Review can not be requested from author"
.
Expected behavior:
Author is skipped, all other users added as reviewers.
Actual behavior:
0 reviewers added.
Config:
# Set to true to add reviewers to pull requests
addReviewers: true
# Set to author to set pr creater as assignee
addAssignees: author
# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- deva
- devb
- devc
- devd
# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0
# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- wip
I might be missing it, but if not, it would be cool if the configuration allowed for specification to the number of reviewers to be selected from each review group. For example
numberOfReviewersGroupA: 1
numberOfReviewersGroupB: 2
reviewGroups:
groupA:
- foo
- bar
groupB:
- foobar
- baz
- foobaz
I understand this may be a bit challenging to pull off, but throwing it out there.
Taking a look at the code, it appears that the owner / author can not be an assignee in conjunction with other assignees.
https://github.com/kentaro-m/auto-assign-action/blob/master/src/utils.ts
For example:
addAssignees: true
assignees:
- contributor1
- contributor2
- contributor3
- contributor4
- contributor5
- contributor6
numberOfAssignees: 6
When contributor1
is the author/owner of the PR, they won't be included even the numberOfAssignees
is a number large enough to include them in the sample of the collection.
Issue: I'm wondering what the intent is for this logic, and if the project is open to allowing an option in the config to include author/owner along with other assignees.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@types/jest
, @types/js-yaml
, @types/lodash
, @types/node
).github/workflows/pull-request.yml
kentaro-m/auto-assign-action v2.0.0
.github/workflows/release-note.yml
release-drafter/release-drafter v5
.github/workflows/test.yml
actions/checkout v4
actions/setup-node v4
.node-version
node 20.13.1
package.json
@actions/core ^1.6.0
@actions/github ^5.0.0
js-yaml ^3.13.1
lodash ^4.17.20
@octokit/webhooks-types 7.5.1
@types/jest 29.4.0
@types/js-yaml 3.12.1
@types/lodash 4.14.141
@types/node 20.11.13
@vercel/ncc 0.38.1
husky 8.0.3
jest 29.7.0
jest-circus 29.7.0
jest-mock 29.7.0
lint-staged 13.3.0
prettier 3.2.5
ts-jest 29.1.3
typescript 5.4.5
I wanted to setup the action on my repository but it fails running: https://github.com/mainrs/git-cm/pull/33/checks?check_run_id=898404696
The console says:
Run kentaro-m/[email protected]
with:
repo-token: ***
configuration-path: .github/auto_assign.yml
##[error]Not Found
This would be a nice feature to have, I tested this thinking it might work, but it unfortunately doesn't. When you try to assign a team as a reviewer, the workflow will succeed, but the PR will not have the team added as a reviewer.
We are finding it annoying when a PR requester takes care to request specific people to review a PR, then the action comes along and adds more. A great flag would be to be able to skip adding reviews if the numberOfReviewers
has been met or to skip adding reviews completely in this case.
Hi Could you please enable dependabot on this repository? We would like to use this action but we cannot use it since we see a critical issue when we do a scan on the repository.
Issue we see is the following;
We are getting an error in our CI that is using 'Auto Assign Action'.
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: kentaro-m/auto-assign-action
Could you please update action.yml to use Node 16?
runs: using: 'node16'
Workflows using this action receive deprecation warnings.
Please provide a new action release that runs with Node 20.
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Cannot find preset's package (github>kentaro-m/renovate-config)
Given the following workflow:
name: 'Auto Assign PR Reviewers'
on: pull_request
jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/[email protected]
with:
configuration-path: ".github/auto_assign.yml"
repo-token: '${{ secrets.GITHUB_TOKEN }}'
And the following auto_assign.yml
:
addReviewers: true
addAssignees: author
reviewers:
- nrb
- ashish-amarnath
- carlisia
I see the following output when running this action against all PRs
Run kentaro-m/[email protected]
with:
configuration-path: .github/auto_assign.yml
repo-token: ***
##[warning]Resource not accessible by integration
##[warning]Resource not accessible by integration
I'm not quite sure what I've got wrong. You can see the directory structure at https://github.com/vmware-tanzu/velero/tree/main/.github
I was also seeing this behavior without the GITHUB_TOKEN
, and added it thinking that would give the action access to act on the repository.
I do not understand where I am supposed to enter the reviewer list. Could you please explain it a little bit ?
Hi, @kentaro-m currently we have a problem when reviewer approved the PR & any file changed in PR, reviewer got re-request review (not always happens and I don't know the trigger of this) Do you know anything about this?
I was trying out this action, but an warning "Resource not accessible by integration" was reported and no reviewers were assigned.
The output is here: https://github.com/bluven-org/test/actions/runs/5374670624/jobs/9750300069
My action config:
jobs:
add-reviews:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: kentaro-m/[email protected]
with:
configuration-path: '.github/reviewers2.yaml' # Only needed if you use something other than .github/auto_assign.yml
name: 'Auto Assign'
on:
pull_request:
types: [opened, reopened, ready_for_review]
jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- name: 'Auto Assign Action'
uses: kentaro-m/[email protected]
with:
addReviewers: true
addAssignees: false
reviewers:
- test
numberOfReviewers: 1
Hi we are trying to set up this action such that when a PR is approved by a developer this action will auto-assign a QA engineer. The following is my GitHub action and auto-assign-action config. When this is used however the message Warning: Empty value for parameter 'pull_number': undefined
is shown. I believe this is because we are using the pull_request_review
action instead of pull_request
or pull_request_target
and so the PR number cannot be found. Is there a way to do this today or is a change required to add this functionality?
.github/auto_assign_qa.yml
addReviewers: true
addAssignees: false
reviewers:
- samkio
numberOfReviewers: 0
.github/workflows/qa-assign.yml
name: "Auto assign QA reviewers"
on:
pull_request_review:
types: [submitted]
jobs:
add-qa-reviewers:
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-add-labels@v1
with:
labels: "ready for test"
- uses: kentaro-m/[email protected]
with:
configuration-path: ".github/auto_assign_qa.yml"
Log:
Run kentaro-m/[email protected]
with:
configuration-path: .github/auto_assign_qa.yml
repo-token: ***
Warning: Empty value for parameter 'pull_number': undefined
In my tests numberOfReviewers
does not default to 0
. If I omit numberOfReviewers: 0
then only one reviewer is added. If I explicitly add numberOfReviewers: 0
then all the reviewers I listed are added, which is the behavior I was looking for.
Gretings!
I did not understand why would anyone use groups with the current implementation. For example, assume that I am devA
.
# Single list
reviewers:
- devA
- devB
- devC
- devD
# Multiple groups
useReviewGroups: true
reviewGroups:
fe:
- devA
- devB
be:
- devC
- devD
In both cases, all the other 3 devs will be assigned.
I expected that, because I belong to team fe
, only devB
would be assigned. Instead, the result is the same of using a single list.
I'm curious why the decision was made to use the common inline configuration for the sole purpose of specify the path to the separate action configuration yaml file?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.