Skip to content

Commit 8772062

Browse files
authored
Merge pull request #47 from pyth-network/feature/gatekeeper-comment-review-details
Fix comment updates for approvals
2 parents 8080d8c + 63185f7 commit 8772062

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

.github/workflows/ai-gatekeeper.yaml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
echo "conclusion=success" >> "$GITHUB_OUTPUT"
3737
printf 'summary=%s\n' "No PR context; skipping gatekeeper checks." >> "$GITHUB_OUTPUT"
3838
echo "details=" >> "$GITHUB_OUTPUT"
39+
echo "is_bot=false" >> "$GITHUB_OUTPUT"
3940
exit 0
4041
fi
4142
@@ -57,8 +58,10 @@ jobs:
5758
echo "conclusion=success" >> "$GITHUB_OUTPUT"
5859
printf 'summary=%s\n' "Not a Devin-authored PR. Skipping human-review enforcement." >> "$GITHUB_OUTPUT"
5960
echo "details=" >> "$GITHUB_OUTPUT"
61+
echo "is_bot=false" >> "$GITHUB_OUTPUT"
6062
exit 0
6163
fi
64+
echo "is_bot=true" >> "$GITHUB_OUTPUT"
6265
6366
# 3. Reduce to latest review per human
6467
LATEST_REVIEWS_JSON=$(
@@ -103,8 +106,8 @@ jobs:
103106
fi
104107
105108
echo "approvals.human_unique=$COUNT" >> "$GITHUB_OUTPUT"
106-
echo "approvals.list=$APPROVERS" >> "$GITHUB_OUTPUT"
107-
echo "approvals.missing=$MISSING" >> "$GITHUB_OUTPUT"
109+
echo "approvals_list=$APPROVERS" >> "$GITHUB_OUTPUT"
110+
echo "approvals_missing=$MISSING" >> "$GITHUB_OUTPUT"
108111
{
109112
echo "details<<EOF"
110113
echo "$DETAILS"
@@ -141,23 +144,31 @@ jobs:
141144
-f output[text]="$DETAILS"
142145
143146
- name: Post Security Comment
144-
if: steps.evaluate.outputs.conclusion == 'failure'
147+
if: steps.evaluate.outputs.is_bot == 'true'
145148
continue-on-error: true
146149
env:
147150
GH_TOKEN: ${{ github.token }}
148151
PR: ${{ github.event.pull_request.number }}
149152
REPO: ${{ github.repository }}
150-
APPROVERS: ${{ steps.evaluate.outputs.approvals.list }}
151-
MISSING: ${{ steps.evaluate.outputs.approvals.missing }}
153+
APPROVERS: ${{ steps.evaluate.outputs.approvals_list }}
154+
MISSING: ${{ steps.evaluate.outputs.approvals_missing }}
155+
CONCLUSION: ${{ steps.evaluate.outputs.conclusion }}
152156
run: |
153157
set -euo pipefail
154158
MARKER="<!-- bot-proxy-gatekeeper-comment -->"
155159
APPROVER_LINE="Current approvals: ${APPROVERS:-none}"
156-
MSG=$(printf "%s\n%s\n\n**%s**\n**Missing:** %s" \
157-
"$MARKER" \
158-
"⚠️ **Review Required**: A **human** is required to review bot PRs. 2 different human approvals are required before this PR can be merged." \
159-
"$APPROVER_LINE" \
160-
"$MISSING")
160+
if [ "$CONCLUSION" = "success" ]; then
161+
MSG=$(printf "%s\n%s\n\n**%s**" \
162+
"$MARKER" \
163+
"✅ **Review Requirements Satisfied**: 2 different human approvals are present." \
164+
"$APPROVER_LINE")
165+
else
166+
MSG=$(printf "%s\n%s\n\n**%s**\n**Missing:** %s" \
167+
"$MARKER" \
168+
"⚠️ **Review Required**: A **human** is required to review bot PRs. 2 different human approvals are required before this PR can be merged." \
169+
"$APPROVER_LINE" \
170+
"${MISSING:-2}")
171+
fi
161172
162173
COMMENT_ID=$(
163174
gh api "repos/$REPO/issues/$PR/comments" \

0 commit comments

Comments
 (0)