feat: trigger on issues opened when @cursor in title or body
Extend check-comment.sh to parse issues event payloads; document issue_comment + issues opened as supported workflow triggers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,6 +27,8 @@ name: Cursor Agent
|
|||||||
on:
|
on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cursor:
|
cursor:
|
||||||
@@ -70,7 +72,7 @@ For playground repos that commit directly to the default branch (no PR workflow)
|
|||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
When someone mentions `@cursor` in a new issue or PR comment:
|
When someone mentions `@cursor` in a new issue (title or body), a new issue/PR comment, or similar:
|
||||||
|
|
||||||
1. The action parses the webhook payload (`GITHUB_EVENT_PATH`) and checks for `@cursor`.
|
1. The action parses the webhook payload (`GITHUB_EVENT_PATH`) and checks for `@cursor`.
|
||||||
2. Comments from the `cursor` user are ignored to prevent feedback loops.
|
2. Comments from the `cursor` user are ignored to prevent feedback loops.
|
||||||
@@ -93,6 +95,7 @@ You can ask Cursor to review a PR, refine a feature request, or implement a chan
|
|||||||
|
|
||||||
## Supported events
|
## Supported events
|
||||||
|
|
||||||
- `issue_comment` with `types: [created]` — issue and PR timeline comments (recommended)
|
- `issue_comment` with `types: [created]` — issue and PR timeline comments
|
||||||
|
- `issues` with `types: [opened]` — new issue if `@cursor` appears in title or body
|
||||||
|
|
||||||
`pull_request_review_comment` is not enabled by default: Gitea's payload uses a `review` object instead of `comment`, which is easy to get wrong. Open an issue if you need that trigger tested on your Gitea version.
|
`pull_request_review_comment` is not enabled by default: Gitea's payload uses a `review` object instead of `comment`, which is easy to get wrong. Open an issue if you need that trigger tested on your Gitea version.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Agent Quick Start
|
## Agent Quick Start
|
||||||
|
|
||||||
- **What:** Gitea composite Action — `@cursor` in issue/PR comments runs Cursor CLI + gitea-mcp on the Actions runner.
|
- **What:** Gitea composite Action — `@cursor` in issue/PR comments or new issues runs Cursor CLI + gitea-mcp on the Actions runner.
|
||||||
- **Gitea:** https://gitea.schwenk.online — repo `froxxxy/cursor-gitea-agent`
|
- **Gitea:** https://gitea.schwenk.online — repo `froxxxy/cursor-gitea-agent`
|
||||||
- **Default model:** `composer-2.5` (override via `ai_model` input only when Fränky asks)
|
- **Default model:** `composer-2.5` (override via `ai_model` input only when Fränky asks)
|
||||||
- **Runner:** Gitea Actions on `boka`
|
- **Runner:** Gitea Actions on `boka`
|
||||||
@@ -14,7 +14,7 @@ cursor-gitea-agent
|
|||||||
|
|
||||||
## One-Liner
|
## One-Liner
|
||||||
|
|
||||||
Gitea Action that triggers Cursor AI when `@cursor` is mentioned in issue or PR comments.
|
Gitea Action that triggers Cursor AI when `@cursor` is mentioned in issue/PR comments or new issues.
|
||||||
|
|
||||||
## Vision
|
## Vision
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,18 @@ fi
|
|||||||
|
|
||||||
OUTPUT_FILE="${GITHUB_OUTPUT:?GITHUB_OUTPUT is not set}"
|
OUTPUT_FILE="${GITHUB_OUTPUT:?GITHUB_OUTPUT is not set}"
|
||||||
|
|
||||||
COMMENT_BODY=$(jq -r '
|
COMMENT_BODY=$(jq -r \
|
||||||
|
--arg event_name "${GITHUB_EVENT_NAME:-}" \
|
||||||
|
'
|
||||||
if .comment?.body? then .comment.body
|
if .comment?.body? then .comment.body
|
||||||
elif .review?.body? then .review.body
|
elif .review?.body? then .review.body
|
||||||
|
elif $event_name == "issues" then
|
||||||
|
((.issue.title // "") + "\n" + (.issue.body // ""))
|
||||||
else empty end
|
else empty end
|
||||||
' "$EVENT_FILE")
|
' "$EVENT_FILE")
|
||||||
|
|
||||||
if [ -z "$COMMENT_BODY" ]; then
|
if [ -z "$COMMENT_BODY" ]; then
|
||||||
echo "No comment or review body in event payload — skipping."
|
echo "No @cursor trigger text in event payload — skipping."
|
||||||
echo "run_cursor=false" >> "$OUTPUT_FILE"
|
echo "run_cursor=false" >> "$OUTPUT_FILE"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -63,6 +67,11 @@ jq \
|
|||||||
id: .review.id,
|
id: .review.id,
|
||||||
user: (.sender.login // "unknown")
|
user: (.sender.login // "unknown")
|
||||||
}
|
}
|
||||||
|
elif ($event_name == "issues") and .issue then {
|
||||||
|
body: ((.issue.title // "") + "\n" + (.issue.body // "")),
|
||||||
|
id: null,
|
||||||
|
user: (.sender.login // .issue.user.login // "unknown")
|
||||||
|
}
|
||||||
else null end
|
else null end
|
||||||
),
|
),
|
||||||
issue: {
|
issue: {
|
||||||
|
|||||||
Reference in New Issue
Block a user