Skip to content

Commit

Permalink
pr: always re-fetch PR for returned work items
Browse files Browse the repository at this point in the history
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Sep 23, 2020
1 parent 72b87eb commit 5135120
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -188,6 +188,9 @@ public Collection<WorkItem> run(Path scratchPath) {
throw new UncheckedIOException(e);
}
}
return List.of(new CommandWorkItem(bot, pr, errorHandler));

// Must re-fetch PR after executing CheckRun
var updatedPR = pr.repository().pullRequest(pr.id());
return List.of(new CommandWorkItem(bot, updatedPR, errorHandler));
}
}
Expand Up @@ -216,7 +216,10 @@ public Collection<WorkItem> run(Path scratchPath) {
if (nextCommand.isEmpty()) {
log.info("No new non-external PR commands found, stopping further processing");
// When all commands are processed, it's time to check labels
return List.of(new LabelerWorkItem(bot, pr, errorHandler));
// Must re-fetch PR after running the command, the command might have updated the PR
var updatedPR = pr.repository().pullRequest(pr.id());

return List.of(new LabelerWorkItem(bot, updatedPR, errorHandler));
}

var census = CensusInstance.create(bot.censusRepo(), bot.censusRef(), scratchPath.resolve("census"), pr,
Expand Down

1 comment on commit 5135120

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 5135120 Sep 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.