Commit Graph

13 Commits

Author SHA1 Message Date
Alem Tuzlak c8cfb2bbe1 ci: switch from base-action to Claude CLI for social copy generator
Replace anthropics/claude-code-base-action@beta with the Claude Code
CLI (`claude -p` with `--output-format json`). This gives direct
control over the output format — a single JSON object with a `result`
field instead of ambiguous JSONL. The extraction script parses the
JSON, strips preamble, and writes clean markdown to pr-social-copy.md
which is uploaded as the artifact and posted to the PR comment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:44:18 +01:00
Alem Tuzlak 4d05bb9bd9 fix(ci): parse JSONL output format for result extraction
The claude-execution-output.json is JSONL (one JSON object per line),
not a single JSON object. JSON.parse() on the whole file silently
failed, producing empty output. Now parses line by line, finding the
"type": "result" entry or falling back to the last assistant message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:18:06 +01:00
Alem Tuzlak 31575b8f72 ci: move hashtags from Twitter to LinkedIn post
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:12:41 +01:00
Alem Tuzlak d0318e8723 fix(ci): upload clean markdown artifact, remove blog length limit
- Extract result text and save as pr-social-copy.md (not raw JSON)
- Strip preamble/analysis before first ### header
- Upload the markdown file as the artifact (90-day retention)
- Comment reads from the same markdown file
- Remove character limit from blog post and LinkedIn (only Twitter
  keeps 280 char limit)
- Instruct Claude to skip preamble and start directly with content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:04:19 +01:00
Alem Tuzlak 7cb8eba6f8 fix(ci): block TodoWrite, handle error_during_execution
- Add disallowed_tools to prevent Claude from wasting turns on
  TodoWrite, Edit, Write, and other non-essential tools that cause
  error_during_execution crashes
- Make extract/upload/update steps run with always() so they still
  execute even if Claude's step exits with error_during_execution
- Add JSONL log fallback: if result field is empty, scan assistant
  messages for the generated content (contains ###)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:59:33 +01:00
Alem Tuzlak 36be36f789 ci: add artifact download link to generated comment
Add a direct "Download full output" link in the comment footer that
points to the uploaded artifact, alongside the existing workflow run
link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:49:36 +01:00
Alem Tuzlak 1faa662dc3 fix(ci): write diff files inside repo for Claude sandbox access
Claude Code sandboxes file access to the working directory. Files in
/tmp are inaccessible regardless of allowed_tools config. Move diff
files and extracted result to .claude-tmp/ inside the repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:39:21 +01:00
Alem Tuzlak fdc98c42e2 fix(ci): fix output capture, add Read tool, upload artifact
- Add `Read` to allowed_tools so Claude can read the diff files
- Read Claude output from JSON file instead of step output (fixes
  empty result caused by multiline content breaking GH Actions outputs)
- Upload claude-execution-output.json as a downloadable artifact
- Add link to workflow run in the success comment footer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:37:08 +01:00
Alem Tuzlak b61b8b2313 ci: add workflow run link to generating state comment
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:27:05 +01:00
Alem Tuzlak 78b92955a8 ci: skip social copy generator for fork PRs and external users
- Skip posting the initial comment on PRs from forks (job-level guard
  + runtime check for workflow_dispatch)
- Verify the checkbox clicker has write/admin permission before
  running generation (prevents external collaborators from triggering
  Claude API calls)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:24:46 +01:00
Alem Tuzlak e64ef5f542 fix(ci): pass anthropic_api_key as input, not env var
The claude-code-base-action expects anthropic_api_key as a `with:`
input parameter, not an `env:` variable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:01:30 +01:00
Alem Tuzlak 96d595a660 ci: support workflow_dispatch for existing/merged PRs
Add workflow_dispatch trigger with pr_number input so the social copy
generator can be used on any existing PR (open or merged). Also adds
duplicate comment detection and a GitHub API diff fallback for merged
PRs where the branch may have been deleted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 14:49:21 +01:00
Alem Tuzlak 365471d357 ci: add social copy generator workflow
Add a GitHub Actions workflow that posts a comment on every new PR with a
checkbox to generate social media copies (Twitter/X, LinkedIn, Blog Post)
using Claude Code. Checking the checkbox triggers Claude to analyze the PR
diff and generate content. After generation, the checkbox resets to
"Regenerate" so users can re-trigger after pushing new changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 14:22:15 +01:00