diff --git a/Readme.md b/Readme.md index 52f7654..50e8d15 100644 --- a/Readme.md +++ b/Readme.md @@ -27,6 +27,8 @@ name: Cursor Agent on: issue_comment: types: [created] + issues: + types: [opened] jobs: cursor: @@ -70,7 +72,7 @@ For playground repos that commit directly to the default branch (no PR workflow) ## 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`. 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 -- `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. diff --git a/SOUL.md b/SOUL.md index b9fa318..567ca05 100644 --- a/SOUL.md +++ b/SOUL.md @@ -2,7 +2,7 @@ ## 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` - **Default model:** `composer-2.5` (override via `ai_model` input only when Fränky asks) - **Runner:** Gitea Actions on `boka` @@ -14,7 +14,7 @@ cursor-gitea-agent ## 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 diff --git a/scripts/check-comment.sh b/scripts/check-comment.sh index f202e85..91ffea1 100755 --- a/scripts/check-comment.sh +++ b/scripts/check-comment.sh @@ -15,14 +15,18 @@ fi 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 elif .review?.body? then .review.body + elif $event_name == "issues" then + ((.issue.title // "") + "\n" + (.issue.body // "")) else empty end -' "$EVENT_FILE") + ' "$EVENT_FILE") 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" exit 0 fi @@ -63,6 +67,11 @@ jq \ id: .review.id, 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 ), issue: {