Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions .github/workflows/ai-gatekeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
echo "conclusion=success" >> "$GITHUB_OUTPUT"
printf 'summary=%s\n' "No PR context; skipping gatekeeper checks." >> "$GITHUB_OUTPUT"
echo "details=" >> "$GITHUB_OUTPUT"
echo "is_bot=false" >> "$GITHUB_OUTPUT"
exit 0
fi

Expand All @@ -57,8 +58,10 @@ jobs:
echo "conclusion=success" >> "$GITHUB_OUTPUT"
printf 'summary=%s\n' "Not a Devin-authored PR. Skipping human-review enforcement." >> "$GITHUB_OUTPUT"
echo "details=" >> "$GITHUB_OUTPUT"
echo "is_bot=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "is_bot=true" >> "$GITHUB_OUTPUT"

# 3. Reduce to latest review per human
LATEST_REVIEWS_JSON=$(
Expand Down Expand Up @@ -103,8 +106,8 @@ jobs:
fi

echo "approvals.human_unique=$COUNT" >> "$GITHUB_OUTPUT"
echo "approvals.list=$APPROVERS" >> "$GITHUB_OUTPUT"
echo "approvals.missing=$MISSING" >> "$GITHUB_OUTPUT"
echo "approvals_list=$APPROVERS" >> "$GITHUB_OUTPUT"
echo "approvals_missing=$MISSING" >> "$GITHUB_OUTPUT"
{
echo "details<<EOF"
echo "$DETAILS"
Expand Down Expand Up @@ -141,23 +144,31 @@ jobs:
-f output[text]="$DETAILS"

- name: Post Security Comment
if: steps.evaluate.outputs.conclusion == 'failure'
if: steps.evaluate.outputs.is_bot == 'true'
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
APPROVERS: ${{ steps.evaluate.outputs.approvals.list }}
MISSING: ${{ steps.evaluate.outputs.approvals.missing }}
APPROVERS: ${{ steps.evaluate.outputs.approvals_list }}
MISSING: ${{ steps.evaluate.outputs.approvals_missing }}
CONCLUSION: ${{ steps.evaluate.outputs.conclusion }}
run: |
set -euo pipefail
MARKER="<!-- bot-proxy-gatekeeper-comment -->"
APPROVER_LINE="Current approvals: ${APPROVERS:-none}"
MSG=$(printf "%s\n%s\n\n**%s**\n**Missing:** %s" \
"$MARKER" \
"⚠️ **Review Required**: A **human** is required to review bot PRs. 2 different human approvals are required before this PR can be merged." \
"$APPROVER_LINE" \
"$MISSING")
if [ "$CONCLUSION" = "success" ]; then
MSG=$(printf "%s\n%s\n\n**%s**" \
"$MARKER" \
"✅ **Review Requirements Satisfied**: 2 different human approvals are present." \
"$APPROVER_LINE")
else
MSG=$(printf "%s\n%s\n\n**%s**\n**Missing:** %s" \
"$MARKER" \
"⚠️ **Review Required**: A **human** is required to review bot PRs. 2 different human approvals are required before this PR can be merged." \
"$APPROVER_LINE" \
"${MISSING:-2}")
fi

COMMENT_ID=$(
gh api "repos/$REPO/issues/$PR/comments" \
Expand Down