Skip to content

Instantly share code, notes, and snippets.

@eastlondoner
Created January 15, 2026 02:20
Show Gist options
  • Select an option

  • Save eastlondoner/70cc655310782123f243ffe44d2245a2 to your computer and use it in GitHub Desktop.

Select an option

Save eastlondoner/70cc655310782123f243ffe44d2245a2 to your computer and use it in GitHub Desktop.
GitHub Action: Cursor Bot (bugbot) PR review status check for branch protection
# Bugbot Status Check for Cursor Bot Reviews
#
# This GitHub Action integrates cursor[bot] PR reviews with branch protection.
# When cursor[bot] comments "LGTM" on a PR, it sets a success status check.
#
# Setup:
# 1. Add this workflow to .github/workflows/bugbot-status.yml
# 2. Add "bugbot-review" as a required status check in branch protection
# 3. Comment "@cursor please review" on PRs to trigger cursor[bot] review
# 4. When cursor[bot] says "LGTM", the status check passes and PR can merge
#
# Works with: https://cursor.com background agents
name: Bugbot Status Check
on:
issue_comment:
types: [created, edited]
jobs:
check-bugbot-lgtm:
# Only run on PR comments from cursor[bot]
if: |
github.event.issue.pull_request &&
github.event.comment.user.login == 'cursor[bot]'
runs-on: ubuntu-latest
permissions:
statuses: write
pull-requests: read
steps:
- name: Get PR head SHA
id: pr
env:
GH_TOKEN: ${{ github.token }}
run: |
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
echo "sha=$(echo $PR_DATA | jq -r .head.sha)" >> $GITHUB_OUTPUT
- name: Check for LGTM and set status
env:
GH_TOKEN: ${{ github.token }}
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
SHA="${{ steps.pr.outputs.sha }}"
# Check if comment contains LGTM (case insensitive)
if echo "$COMMENT_BODY" | grep -iq "LGTM"; then
echo "Bugbot approved! Setting success status..."
gh api repos/${{ github.repository }}/statuses/$SHA \
-f state=success \
-f context="bugbot-review" \
-f description="Bugbot approved this PR"
else
echo "No LGTM found in bugbot comment"
# Check if this looks like a rejection
if echo "$COMMENT_BODY" | grep -iqE "(issue|bug|problem|fix|error)"; then
echo "Bugbot found issues, setting pending status..."
gh api repos/${{ github.repository }}/statuses/$SHA \
-f state=pending \
-f context="bugbot-review" \
-f description="Bugbot review in progress or found issues"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment