Repository navigation
Notify Grok Bot when a pull request opens or is marked ready - #62
Closed
mark-groves wants to merge 1 commit into
Closed
mark-groves wants to merge 1 commit into
mark-groves wants to merge 1 commit into
Conversation
POST opened and ready_for_review events when the webhook secrets are set. Co-authored-by: Mark Groves <mark-groves@users.noreply.github.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Owner
Author
|
Dropped: Mark declined webhook; daily sweeps cover draft alerts. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a fork-only workflow,
.github/workflows/grokbot-pr-webhook.yml, that POSTs to Mark's Grok Bot routine webhook when a pull request is opened or marked ready for review. A cursor[bot] draft therefore wakes the bot twice:openedat creation ("draft": true) andready_for_reviewwhen it is flipped to ready about 20 seconds later.The trigger is
pull_requestwith typesopenedandready_for_review. Oneubuntu-latestjob,timeout-minutes: 2,permissions: {}, no checkout. Event fields go throughenv:and the body is built withjq -n --arg/--argjson, so a pull request title stays data. The request sendsAuthorization: Bearer $GROKBOT_PR_WEBHOOK_KEYandContent-Type: application/jsonwithcurl --fail-with-body --retry 3 --max-time 20. A non-2xx response fails the job (curl exit 22) so a broken webhook is visible.{"repo": "owner/name", "pr": 123, "action": "opened", "url": "https://github.com/owner/name/pull/123", "title": "title", "author": "login", "draft": false}actionisopenedorready_for_review.pris a number anddraftis a boolean.If
GROKBOT_PR_WEBHOOK_URLorGROKBOT_PR_WEBHOOK_KEYis empty (a pull request from a fork of this fork, or before these secrets exist), the job logs a notice and exits 0.Secrets to add
On
mark-groves/omarchy, open Settings > Secrets and variables > Actions and add these repository secrets:GROKBOT_PR_WEBHOOK_URLGROKBOT_PR_WEBHOOK_KEYThe URL and key are not in the repo. This pull request's
openedrun already finished and took the skip path, because the secrets are still empty. Adding them does not replay that run. The nextopenedorready_for_reviewevent will POST.Fork-only — upstream sync must keep this file
.github/workflows/grokbot-pr-webhook.ymlbelongs only to themark-groves/omarchyfork. It is not in omacom/omarchy. Future Omarchy Sync runs must keep this file when cherry-picking upstreamquattro.Actions is enabled on this fork
GET /repos/mark-groves/omarchy/actions/workflowsreturns HTTP 200, and the workflow is registered asstate: active. Run 37692704969 completed success in 7s on this pull request (pull_request/opened, head51dbf25c).gh run listshows that run.GET /repos/mark-groves/omarchy/actions/permissionsreturned 403 because this token is not an admin; the successful run is the enabled signal.The live log shows both secrets empty, the event fields filled in, and the skip notice:
GITHUB_TOKENon that job is Metadata: read, which is whatpermissions: {}allows.Proof
actionlintv1.7.12 with shellcheck 0.9.0: exit 0, no findings.The job script was extracted from the workflow and run with
bash --noprofile --norc -eo pipefailagainst a local HTTP listener. The sample event is the GitHub pull payload for draft PR #57 (cursor[bot]). Theready_for_reviewcase uses that same payload withactionset toready_for_reviewanddraftset to false, which is what GitHub sends when a draft is marked ready. A third case puts shell metacharacters in the title. The listener recorded:prarrived as a JSON number anddraftas a JSON boolean. The injection title was stored as a string; nothing executed it.Empty
GROKBOT_PR_WEBHOOK_URL, emptyGROKBOT_PR_WEBHOOK_KEY, and both empty each printed the notice and exited 0, and the listener received no extra request.A listener that returns HTTP 500 made the script exit 22 after 4 attempts (
--retry 3retried the POST at 1s, 2s, and 4s).