Repository navigation
docs: make 'human' bold in README #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Devin Proxy Gatekeeper | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened] | |
| pull_request_review: | |
| types: [submitted, edited, dismissed] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| issues: write | |
| concurrency: | |
| group: gatekeeper-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| enforce-human-review: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Analyze Authorship and Approvals | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| # 1. Fetch PR Data | |
| PR_DATA=$(gh pr view $PR --repo $REPO --json author,body,commits,reviews) | |
| # 2. Only enforce when Devin is the PR author | |
| IS_BOT_PR=$(echo "$PR_DATA" | jq '.author.login == "devin-ai-integration[bot]"') | |
| if [ "$IS_BOT_PR" != "true" ]; then | |
| echo "✅ Not a Devin-authored PR. Skipping check." | |
| exit 0 | |
| fi | |
| # 3. Filter for human approvals only | |
| APPROVERS=$( | |
| echo "$PR_DATA" | jq -r ' | |
| [.reviews[] | select(.state=="APPROVED" and (.author.login | endswith("[bot]") | not))] | |
| | map(.author.login) | |
| | unique | |
| | .[] | |
| ' | |
| ) | |
| COUNT=$(echo "$APPROVERS" | grep -v '^$' | wc -l || echo 0) | |
| # 4. Enforcement Logic | |
| if [ "$COUNT" -lt 2 ]; then | |
| echo "❌ FAIL: 2 human approvals required for Devin-authored PRs." | |
| exit 1 | |
| fi | |
| echo "✅ Security requirements satisfied." | |
| - name: Post Security Comment | |
| if: failure() | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR: ${{ github.event.pull_request.number }} | |
| run: | | |
| MSG="⚠️ **Review Required**: 2 different **human** approvals are required for Devin-authored PRs." | |
| gh pr comment $PR --body "$MSG" |