Skip to content

Commit

Permalink
feat(app/automatic-dev-flow): move on changes requested
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Kiefer authored and nikku committed Mar 13, 2022
1 parent c5d97e3 commit c67f1ba
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/app/lib/apps/automatic-dev-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const DONE = 'DONE';
const EXTERNAL_CONTRIBUTION = 'EXTERNAL_CONTRIBUTION';
const IN_PROGRESS = 'IN_PROGRESS';
const IN_REVIEW = 'IN_REVIEW';
const CHANGES_REQUESTED = 'changes_requested';


/**
Expand Down Expand Up @@ -97,6 +98,31 @@ module.exports = function(webhookEvents, githubIssues, columns) {
await githubIssues.moveReferencedIssues(context, pull_request, column);
});

webhookEvents.on('pull_request_review.submitted', async (context) => {

const {
pull_request,
review
} = context.payload;

const {
state: reviewState
} = review;

if (reviewState !== CHANGES_REQUESTED) {
return;
}

const state = isExternal(pull_request) ? EXTERNAL_CONTRIBUTION : IN_PROGRESS;

const column = columns.getByState(state);

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

webhookEvents.on('create', async (context) => {

const {
Expand Down

0 comments on commit c67f1ba

Please sign in to comment.