Skip to content

Commit

Permalink
Merge pull request #3099 from lucasmlp/dev-v2.8
Browse files Browse the repository at this point in the history
Removes requirement for the thumbs up reaction to be from the PR's author
  • Loading branch information
rohitsakala committed Oct 4, 2023
2 parents 41cd262 + de9c28e commit 0fad9f0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 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,15 @@ 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 latest 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.");
core.setFailed("No validation comments by github-actions[bot] found.");
}

0 comments on commit 0fad9f0

Please sign in to comment.