Skip to content

Commit

Permalink
Removes requirement for the thumbs up reaction to be from the PR's au…
Browse files Browse the repository at this point in the history
…thor
  • Loading branch information
lucasmlp committed Oct 4, 2023
1 parent 5cd0ee4 commit 7c2ea58
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/validation-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
check-reaction:
name: Check for positive reaction on bot's latest validation comment from PR author
name: Check for positive reaction on bot's latest validation comment
if: startsWith(github.event.pull_request.base.ref, 'dev-v') || startsWith(github.event.pull_request.base.ref, 'release-v')
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -35,16 +35,14 @@ jobs:
repo: context.repo.repo
});
// Check if the PR author gave a thumbs-up reaction on the bot's validation comment
const authorReaction = reactions.data.find(reaction => reaction.user.login === context.payload.pull_request.user.login && reaction.content === '+1');
// Check if there's a thumbs-up reaction on the bot's validation comment
const thumbsUpReaction = reactions.data.some(reaction => reaction.content === '+1');
if (authorReaction) {
console.log("The latest validation comment by github-actions[bot] has the required thumbs-up reaction from the PR author.");
if (thumbsUpReaction) {
console.log("The validation comment by github-actions[bot] has the required thumbs-up reaction.");
} else {
const createdAt = new Date(latestValidationComment.created_at).toLocaleString('en-US', { timeZoneName: 'short' });
console.error("Failed Check - Comment Created At:", createdAt);
core.setFailed("The latest validation comment by github-actions[bot] does not have the required thumbs-up reaction from the PR author!");
core.setFailed("The validation comment by github-actions[bot] does not have the required thumbs-up reaction!");
}
} else {
console.warn("No validation comments by github-actions[bot] found.");
console.log("No validation comments by github-actions[bot] found.");
}

0 comments on commit 7c2ea58

Please sign in to comment.