Skip to content

Commit

Permalink
fix: change approval emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoaldamav committed Nov 2, 2023
1 parent 435851e commit df2c2dc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
repo: context.repo.repo,
issue_number: issue_number,
});
const approvalComment = comments.data.find(comment => comment.body.includes('Please approve this PR by reacting with an "ok" emoji to this comment.') && comment.user.login === 'github-actions[bot]');
const approvalComment = comments.data.find(comment => comment.body.includes('Please approve this PR by reacting with an "👍".') && comment.user.login === 'github-actions[bot]');
if (approvalComment) {
core.setOutput('commentExists', 'true');
core.setOutput('commentId', approvalComment.id);
Expand All @@ -75,25 +75,30 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Please approve this PR by reacting with an "ok" emoji to this comment.'
body: 'Please approve this PR by reacting with an "👍".'
});
core.setOutput('result', comment.data.id);
return comment.data.id;
- name: Wait for Approval
run: |
comment_id=${{ steps.check-comment.outputs.result || steps.create-comment.outputs.result }}
echo "Comment ID: $comment_id"
counter=0
while [ $counter -lt 15 ]; do
echo "Checking for approvals, attempt $((counter + 1))"
response=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.squirrel-girl-preview+json" "https://api.github.com/repos/${{ github.repository }}/issues/comments/$comment_id/reactions")
approved=$(echo "$response" | jq '.[] | select(.content == "ok") | .user.login' | grep -wFf <(echo $TEAM_MEMBERS))
echo "Response: $response"
approved=$(echo "$response" | jq '.[] | select(.content == "+1") | .user.login')
echo "Approved: $approved"
if [ -n "$approved" ]; then
echo "PR has been approved by a team member."
break
fi
sleep 60
((counter++))
done
if [ $counter -ge 15 ]; then
echo "Timeout reached for Approval - 15m. Exiting..."
exit 1
Expand Down

0 comments on commit df2c2dc

Please sign in to comment.