Skip to content

Commit

Permalink
bot: check for PR updates (#1878)
Browse files Browse the repository at this point in the history
  • Loading branch information
cartermckinnon authored Jul 12, 2024
1 parent dcbde24 commit 620f325
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/actions/bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class CICommand {
this.repository_name = payload.repository.name;
this.pr_number = payload.issue.number;
this.comment_url = payload.comment.html_url;
this.comment_created_at = payload.comment.created_at;
this.uuid = uuid;
this.goal = "test";
// "test" goal, which executes all CI stages, is the default when no goal is specified
Expand Down Expand Up @@ -217,6 +218,14 @@ class CICommand {
default:
throw new Error(`Unknown mergeable value: ${mergeable}`);
}
const merge_commit = await github.rest.commits.get({
owner: this.repository_owner,
repo: this.repository_name,
ref: pr.data.merge_commit_sha
});
if (new Date(this.comment_created_at) < new Date(merge_commit.data.author.date)) {
return `@${author} this PR has been updated since your request, you'll need to review the changes.`;
}
const inputs = {
uuid: this.uuid,
pr_number: this.pr_number.toString(),
Expand Down

0 comments on commit 620f325

Please sign in to comment.