You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+73-49
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,19 @@
6
6
7
7
Each of these actions are discrete, and can be enabled separately if desired.
8
8
9
+
### `assign`: Automatically adjust PR assignees based on who is most responsible for pushing it forward
10
+
11
+
The heart and soul of the toolset: this action will automatically adjust assignees on a pull request such that the current assignees are the ones that must take action to move the pull request forward. Here's an example timeline of actions for a PR submitted by author X:
12
+
13
+
- PR from author X arrives. Any requested reviewers (let's say reviewers A, B, and C) are assigned.
14
+
- Reviewer A leaves a review requesting changes. Reviewers A, B, and C are unassigned, and author X is assigned to address A's review.
15
+
- X makes changes to the PR and re-requests review from reviewer A. Since there are no outstanding Changes Requested reviews, all requested reviewers that haven't yet approved (A, B, C) are put back on the PR.
16
+
- Reviewer B approves the PR, and is unassigned. Reviewers A and C are still assigned.
17
+
- Reviewer C approves the PR, and is unassigned. Reviewer A is still assigned.
18
+
- etc...
19
+
20
+
In effect, this turns Github's Assignee field from a vague "point person" to a clear indicator of responsibility.
21
+
9
22
### `request`: Automatically request reviewers on new pull requests
10
23
11
24
When a new PR arrives, this action will request a (configurable) number of reviewers, pulling from a mixture of:
@@ -20,20 +33,7 @@ Inputs:
20
33
-`reviewers`: the team name to pull reviewers from in the parent repo's organization
21
34
-`num_to_request`: the number of reviewers to request on new PRs
22
35
23
-
You can see an example of how inputs should be specified in the example workflow below.
24
-
25
-
### `assign`: Automatically adjust PR assignees based on who is most responsible for pushing it forward
26
-
27
-
The heart and soul of the toolset: this action will automatically adjust assignees on a pull request such that the current assignees are the ones that must take action to move the pull request forward. Here's an example timeline of actions for a PR submitted by author X:
28
-
29
-
- PR from author X arrives. Any requested reviewers (let's say reviewers A, B, and C) are assigned.
30
-
- Reviewer A leaves a review requesting changes. Reviewers A, B, and C are unassigned, and author X is assigned to address A's review.
31
-
- X makes changes to the PR and re-requests review from reviewer A. Since there are no outstanding Changes Requested reviews, all requested reviewers that haven't yet approved (A, B, C) are put back on the PR.
32
-
- Reviewer B approves the PR, and is unassigned. Reviewers A and C are still assigned.
33
-
- Reviewer C approves the PR, and is unassigned. Reviewer A is still assigned.
34
-
- etc...
35
-
36
-
In effect, this turns Github's Assignee field from a vague "point person" to a clear indicator of responsibility.
36
+
You can see an example of how inputs should be specified in the Usage section below.
37
37
38
38
### `copy-labels-linked`: Copy any labels present on linked issues to PRs
39
39
@@ -45,26 +45,9 @@ When a pull request meets a repo's configured criteria for [mergeability](https:
45
45
46
46
## Usage
47
47
48
-
Setup takes just a few straightforward steps.
49
-
50
-
### Authenticating with Github
51
-
52
-
Many `actions-automation` actions rely on a [personal access token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
53
-
to interact with Github and work their magic. If you're setting up a new
54
-
repository for use with `actions-automation` tools, you'll need to provision one with the `public_repo`, `read:org`, and `write:org`
55
-
scopes enabled and make it available as a [shared secret](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets)
56
-
to your repository, using the name `BOT_TOKEN`. (Organization-wide secrets also work.)
actions: "request,assign,copy-labels-linked,merge"# The actions to run.
125
-
reviewers: "reviews"# The team to pull reviewers from for `request`.
126
-
num_to_request: 3# The number of reviewers that `request` should request on new PRs.
127
-
105
+
actions: "assign,copy-labels-linked,merge"# The actions to run.
106
+
token: ${{ secrets.GITHUB_TOKEN }}
128
107
```
129
108
130
-
Note that you'll need to configure the action's inputs accordingly. If none are provided, only the `assign` action will run by default; the rest are opt-in. The other parameters are required for the `request` action, if enabled.
109
+
Note that you'll need to configure the action's inputs accordingly. If none are provided, only the `assign` action will run by default; the rest are opt-in via the `actions` input. Additionally, you'll need to provide a Github access token; the `GITHUB_TOKEN` should suffice for most cases.
131
110
132
111
Once this is in place, you're done! `pull-request-responsibility` should begin working on your repo
133
112
when certain events (ex. an issue/PR gets opened) happen.
134
113
114
+
### Enabling the `request` action
115
+
116
+
You may have noticed that the `request` action is not included in the workflow above. That's because it performs cross-repo API calls and needs some additional setup.
117
+
118
+
### Github authentication with a personal access token
119
+
120
+
The Actions-provided `GITHUB_TOKEN` secret is good for most of what `pull-request-responsibility` does, but it does not have permission to read or write data from outside the repository that spawned it. This poses a problem with the `request` action, which looks at things like user availability and organization-level teams.
121
+
122
+
In order for `request` to function correctly, we'll need to authenticate with Github using a **personal access token** instead of the `GITHUB_TOKEN`. These are user-generated and effectively allow scripts to act as a user through the Github API. You can manage your active tokens [here](https://github.com/settings/tokens).
123
+
124
+
Provision one with the `public_repo`, `read:org`, and `write:org` scopes enabled and make it available as a [shared secret](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets)
125
+
to your repository, using the name `BOT_TOKEN`. (Organization-wide secrets also work.)
creating a separate account for PATs like this, and scoping access to that
130
+
account accordingly. It's recommended to heed their advice; PATs are dangerous if leaked, and can result in malicious actors abusing the account that created it.
131
+
132
+
If you're using any other `actions-automation` tools, chances are this step will be necessary as well. Once the token is available as a secret, however, it should be straightforward to use it in perpetuity.
133
+
134
+
### Enabling `request` in your workflow
135
+
136
+
With the repository secret available, replace the `token` input with your new PAT:
137
+
138
+
```yml
139
+
token: ${{ secrets.BOT_TOKEN }}
140
+
```
141
+
142
+
You'll also need to provide some additional inputs for the action to work (documented in its description):
143
+
144
+
```yml
145
+
reviewers: "reviews" # The team to pull reviewers from for `request`.
146
+
num_to_request: 3# The number of reviewers that `request` should request on new PRs.
147
+
```
148
+
149
+
And, finally, enable the action in the `actions` input:
150
+
151
+
```yml
152
+
actions: "request,assign,copy-labels-linked,merge" # The actions to run.
153
+
```
154
+
155
+
Your completed step should look something like this:
actions: "request,assign,copy-labels-linked,merge" # The actions to run.
161
+
token: ${{ secrets.BOT_TOKEN }}
162
+
reviewers: "reviews" # The team to pull reviewers from for `request`.
163
+
num_to_request: 3# The number of reviewers that `request` should request on new PRs.
164
+
```
165
+
166
+
And you should be done!
167
+
135
168
## FAQ
136
169
137
170
### Why do I need to listen for every single Actions event in my workflow?
@@ -144,15 +177,6 @@ The action doesn't _need_ every trigger to work properly -- in fact, it doesn't
144
177
use most of them at all. However, there's little downside to enabling all of
145
178
them, and doing so avoids the need to change workflows if new functionality using a new trigger is added.
146
179
147
-
### What happens if I don't set `BOT_TOKEN` properly?
148
-
149
-
If `pull-request-responsibility` can't find a valid token under `BOT_TOKEN`, it will fail gracefully
150
-
with a note reminding you to add one if you want to opt into automation. It
151
-
should _not_ send you a failure email about it.
152
-
153
-
This avoids forks of repositories that have `pull-request-responsibility` enabled from spamming their
154
-
authors with needless Actions failure emails about improperly-set credentials.
155
-
156
180
## Credits
157
181
158
182
This action was originally developed for the Enarx project as part of [Enarxbot](https://github.com/enarx/bot), and is now available for any repo to use here.
0 commit comments