Skip to content

feat: have claude open issues for forked branch PRs. - #13780

Open
sayakpaul wants to merge 3 commits into
mainfrom
claude-open-issues-no-commit
Open

sayakpaul wants to merge 3 commits into
mainfrom
claude-open-issues-no-commit

Conversation

@sayakpaul

Copy link
Copy Markdown
Member

What does this PR do?

Follow up from #13774.

@github-actions github-actions Bot added CI size/S PR with diff < 50 LOC labels May 21, 2026
@sayakpaul
sayakpaul requested a review from yiyixuxu May 21, 2026 05:45
@tarekziade

Copy link
Copy Markdown
Contributor

@askserge review this

@sergereview sergereview Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤗 Serge says:

Bug: heredoc terminator will never match — shell syntax error at runtime

The heredoc on line 199 uses <<EOF (not <<-EOF), but the closing EOF on line 207 is indented with spaces. Bash requires the closing delimiter to appear on a line by itself with no leading whitespace when using <<EOF. This means:

  1. The shell will never find the end of the heredoc → syntax error every time the fork-PR path is taken.
  2. Even after fixing the delimiter, the body lines (200-206) carry ~10 columns of leading whitespace that will appear literally in the GitHub issue body.

The fix is to either:

  • Use <<-EOF and indent with tabs (not spaces — <<- only strips tabs), or
  • Remove all leading whitespace from the heredoc body and the closing EOF.

Since the run: block is likely space-indented throughout, the cleanest option is to dedent the body and closing delimiter to column 0 (ugly in YAML but correct), or switch to --body with a variable instead of --body-file.

model: claude-opus-4-6 · 5 LLM turns · 4 tool calls · 31.0s · 36789 in / 1294 out tokens

if [[ "$IS_FORK" == "true" ]]; then
post_status "ℹ️ \`COMMIT THIS\` isn't supported on fork PRs. Apply Claude's suggestions manually, or open an issue to track them. See [workflow run]($RUN_URL)."
ISSUE_BODY_FILE=$(mktemp)
cat > "$ISSUE_BODY_FILE" <<EOF

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: <<EOF requires the closing delimiter to sit at column 0 with no leading whitespace. The EOF on line 207 is indented, so bash will never match it and the script will fail with a syntax error.

Additionally, all the body lines (200-206) will include their leading spaces verbatim in the issue body.

Two options to fix:

  1. Dedent everything to column 0 (works but looks odd in YAML):
Suggested change
cat > "$ISSUE_BODY_FILE" <<EOF
cat > "$ISSUE_BODY_FILE" <<EOF
Claude made edits in response to \`COMMIT THIS\` from @${COMMENT_USER} on fork PR #${PR_NUMBER}, but the workflow can't push to a fork's branch. Tracking the suggested follow-up here.
- Source PR: #${PR_NUMBER}
- Triggering comment: ${COMMENT_URL}
- Workflow run: ${RUN_URL}
See Claude's review comment on #${PR_NUMBER} for the suggested changes.
EOF
  1. Or drop the temp file entirely and use --body with a shell variable.

@sergereview sergereview Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤗 Serge says:

Clean, focused change. The permission bump (issues: readissues: write) is the minimum needed for gh issue create. The new COMMENT_URL env var is sourced from github.event.comment.html_url (GitHub-controlled, not user-controlled). The heredoc indentation is correct after YAML block-scalar stripping. The post_status / REPORTED / EXIT-trap interaction is sound (no duplicate comments). No correctness or security issues found.

model: claude-opus-4-6 · 9 LLM turns · 8 tool calls · 70.2s · 88852 in / 2920 out tokens

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants