Skip to content

Commit

Permalink
Add unassign issue feature (#33924)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickaw authored Feb 10, 2025
1 parent 6cc98ee commit 25425db
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/ACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ jobs:
* **DO NOT** Approve and Run changes in the workflows in the PR Conversation tab, under "Workflow(s) awaiting approval".
* For approving the updates in the workflows, you should go to the Repository Actions and filter All Workflows by `action_required`. The search will display the workflows that need to be reviewed before running. **Please make sure reviewing the file that is referenced by the workflow.**
* Seed job will be emulated using the `Approve and Run` built-in feature of GitHub Actions, since the workflows will use the `pull_request_target` directive; no modifications would be allowed either for new or existent jobs unless a committer explicitly approves the job from GitHub Actions UI.
### Issue Management

#### Issue Management
Phrases self-assign, close, or manage labels on an issue:
| Phrase | Effect |
|--------|--------|
| `.take-issue` | Self-assign the issue |
| `.free-issue` | Self-unassign the issue |
| `.close-issue` | Close the issue as completed |
| `.close-issue not_planned` | Close the issue as not-planned |
| `.reopen-issue` | Reopen a closed issue |
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Once you've created an issue, you can self-assign by commenting `.take-issue` and you can close by commenting `.close-issue`.
Thanks for taking the time to fill out this bug report! Once you've created an issue, you can self-assign by commenting `.take-issue`, self-unassign by commenting `.free-issue`, and close by commenting `.close-issue`.
Anyone can reopen a closed issue by commenting `.reopen-issue`.
You can also add/remove labels by commenting `.add-labels label1,label2,'label 3 with spaces'` or `.remove-labels label1,label2,'label 3 with spaces'`,
or with `.set-labels label1,label2,'label 3 with spaces'` (which removes any labels not in that set).
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/failing_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request! Once you've created an issue, you can self-assign by commenting `.take-issue` and you can close by commenting `.close-issue`.
Thanks for taking the time to fill out this failing test report! Once you've created an issue, you can self-assign by commenting `.take-issue`, self-unassign by commenting `.free-issue`, and close by commenting `.close-issue`.
Anyone can reopen a closed issue by commenting `.reopen-issue`.
You can also add/remove labels by commenting `.add-labels label1,label2,'label 3 with spaces'` or `.remove-labels label1,label2,'label 3 with spaces'`,
or with `.set-labels label1,label2,'label 3 with spaces'` (which removes any labels not in that set).
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request! Once you've created an issue, you can self-assign by commenting `.take-issue` and you can close by commenting `.close-issue`.
Thanks for taking the time to fill out this feature request! Once you've created an issue, you can self-assign by commenting `.take-issue`, self-unassign by commenting `.free-issue`, and close by commenting `.close-issue`.
Anyone can reopen a closed issue by commenting `.reopen-issue`.
You can also add/remove labels by commenting `.add-labels label1,label2,'label 3 with spaces'` or `.remove-labels label1,label2,'label 3 with spaces'`,
or with `.set-labels label1,label2,'label 3 with spaces'` (which removes any labels not in that set).
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this task! Once you've created an issue, you can self-assign by commenting `.take-issue` and you can close by commenting `.close-issue`.
Thanks for taking the time to fill out this task! Once you've created an issue, you can self-assign by commenting `.take-issue`, self-unassign by commenting `.free-issue`, and close by commenting `.close-issue`.
Anyone can reopen a closed issue by commenting `.reopen-issue`.
You can also add/remove labels by commenting `.add-labels label1,label2,'label 3 with spaces'` or `.remove-labels label1,label2,'label 3 with spaces'`,
or with `.set-labels label1,label2,'label 3 with spaces'` (which removes any labels not in that set).
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/self-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
for (let i = 0; i < body.length; i++) {
const bodyString = body[i].toLowerCase();
if (bodyString == '.take-issue') {
console.log(`Assigining issue to ${context.payload.comment.user.login}`);
console.log(`Assigning issue to ${context.payload.comment.user.login}`);
github.rest.issues.addAssignees({
issue_number: context.issue.number,
owner: context.repo.owner,
Expand All @@ -50,6 +50,18 @@ jobs:
} catch (error) {
console.log(`Failed to remove awaiting triage label. It may not exist on this issue. Error ${error}`);
}
} else if (bodyString == '.free-issue') {
try {
console.log(`Unassigning issue for ${context.payload.comment.user.login}`);
github.rest.issues.removeAssignees({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
assignees: [context.payload.comment.user.login]
});
} catch (error) {
console.log(`Failed to remove ${context.payload.comment.user.login} from issue. It may not exist on this issue. Error ${error});
}
} else if (bodyString == '.close-issue') {
console.log('Closing issue');
if (i + 1 < body.length && body[i+1].toLowerCase() == 'not_planned') {
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ These steps and instructions on getting started are outlined below as well.
Tracking your work in an issue will avoid duplicated or conflicting work, and provide
a place for notes. Later, your pull request will be linked to the issue as well.
2. Comment ".take-issue" on the issue. This will cause the issue to be assigned to you.
Comment ".free-issue" on the issue. This will cause the issue to be unassigned from you.
When you've completed the issue, you can close it by commenting ".close-issue".
If you are a committer and would like to assign an issue to a non-committer, they must comment
on the issue first; please tag the user asking them to do so or to comment "\`.take-issue\`".
Expand Down
1 change: 1 addition & 0 deletions website/www/site/content/en/contribute/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Here’s a list of things you can do to get started contributing:
<td class="list-text-size-md">
<ul>
<li>Comment “.take-issue” on the <a href="https://github.com/apache/beam/issues">issue you'd like to work on</a>. This will cause the issue to be assigned to you.</li>
<li>Comment ".free-issue" on the <a href="https://github.com/apache/beam/issues">issue you'd like to not work on</a>. This will cause the issue to be unassigned from you.</li>
<li>If appropriate, make your change and open a <a href=https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork>Pull Request</a>.</li>
<li>Comment “.close-issue” to close the issue once all work has been completed.</li>
<li>You can find good first issues using the <a href=https://github.com/apache/beam/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22>"good first issue" label</a>.</li>
Expand Down

0 comments on commit 25425db

Please sign in to comment.