Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to automatically assign PRs to their author #129

Merged
merged 4 commits into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/AUTOMATIC_CARD_MOVEMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ The following table summarizes triggers and the card movements those cause.
| Trigger | Action |
| :--- | :--- |
| Branch with `{issueNumber}-some-description` created | Issue moves to `IN_PROGRESS` column and is assigned to branch author |
| Draft PR referencing issue created | Issue moves to `IN_PROGRESS` column |
| PR is marked as ready-for-review | PR and linked issue move to `IN_REVIEW` column |
| Non-draft PR is created | PR and linked issue move to `IN_REVIEW` column |
| Collaborator PR is created | PR and linked issue move to `IN_REVIEW` or `IN_PROGRESS` (if PR is draft) column |
| Collaborator PR is marked as draft | PR and linked issue move to `IN_PROGRESS` column |
| Collaborator PR is marked as ready-for-review | PR and linked issue move to `IN_REVIEW` column |
| Collaborator PR receives `changes_requested` review | PR moves to `IN_PROGRESS` column |
| PR is merged | PR and linked issue move to `DONE` column |
| PR is closed unmerged | PR moves to `DONE` column, linked issue stays where it is |
6 changes: 6 additions & 0 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ Several aspects of [wuffle](https://wuffle.dev) are configured via environment v
| `DISABLE_BACKGROUND_SYNC` | | |


### Behavior

| Parameter | Required? | Description |
| :--- | :---: | :--- |
| `AUTO_ASSIGN_PULLS` | | If set, assign newly created collaborator PRs to the PR author |

### Misc

| Parameter | Required? | Description |
Expand Down
18 changes: 14 additions & 4 deletions packages/app/lib/apps/automatic-dev-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,26 @@ module.exports = function(webhookEvents, githubIssues, columns) {
pull_request
} = context.payload;

const external = isExternal(pull_request);
const draft = isDraft(pull_request);

const newState =
isExternal(pull_request) ? EXTERNAL_CONTRIBUTION : (
isDraft(pull_request) ? IN_PROGRESS : IN_REVIEW
external ? EXTERNAL_CONTRIBUTION : (
draft ? IN_PROGRESS : IN_REVIEW
);

const column = columns.getByState(newState);

const author = pull_request.user;

const newAssignee = (
process.env.AUTO_ASSIGN_PULLS && !external &&
author && author.type === 'User' && author.login
);

await Promise.all([
githubIssues.moveIssue(context, pull_request, column),
githubIssues.moveReferencedIssues(context, pull_request, column)
githubIssues.moveIssue(context, pull_request, column, newAssignee),
githubIssues.moveReferencedIssues(context, pull_request, column, newAssignee)
]);
});

Expand Down
1 change: 1 addition & 0 deletions packages/app/lib/apps/events-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function EventsSync(webhookEvents, store, logger) {
'pull_request.unlabeled',
'pull_request.edited',
'pull_request.ready_for_review',
'pull_request.converted_to_draft',
'pull_request.assigned',
'pull_request.unassigned',
'pull_request.synchronize',
Expand Down
2 changes: 1 addition & 1 deletion packages/board/src/CollaboratorLinks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
margin: 0;
font-size: 14px;
position: relative;
display: inline-block;
display: flex;
text-align: center;
border-radius: 2px;

Expand Down