chore(upstream-sync): improve workflow and prompt handling - #12
Conversation
Add Bash permissions for cat, sort, comm, diff, echo, and grep so the sync agent can run comparison scripts against upstream inputs/outputs.
Move the inline prompt from the upstream-sync workflow into .github/prompts/upstream-sync/01-sync-task.md so it can be composed via the action's prompt_dir mechanism. Includes tool-use issue reporting instructions.
Replace uses: anthropics/claude-code-action@v1 with uses: ./ so the upstream-sync workflow eats our own dogfood like the other workflows. Prompt is now composed from .github/prompts/upstream-sync/ via prompt_dir. Also adds Bash(date:*) to allowed tools and removes the pre-computed sync_date output.
Clarify the distinction between the rolling v1 tag and the actual patch version, and link to individual releases and the releases page.
| ## After making changes | ||
|
|
||
| If you made any meaningful changes: | ||
|
|
There was a problem hiding this comment.
The prompt instructs the agent to compute date +%Y%m%d at runtime, but the workflow previously pre-computed this value in steps.fetch.outputs.sync_date. Now that the workflow no longer provides this value, the agent must compute it during execution.
This works, but it introduces a race condition: if the workflow starts just before midnight and the agent runs just after, the branch name won't match what was intended. The previous approach (pre-computing in the workflow) was more deterministic.
Consider either:
- Restoring the pre-computed date in the workflow, or
- Documenting this edge case in the prompt
| ## Upstream reference | ||
|
|
||
| From release.json, extract the latest patch version tag (e.g. v1.0.52) | ||
| and its published date. Note: the v1 tag is a rolling tag that tracks |
There was a problem hiding this comment.
Instructions reference release.json to extract "the latest patch version tag (e.g. v1.0.52)" and explain that "the v1 tag is a rolling tag that tracks the latest patch release."
However, the instructions don't specify which field(s) in release.json to extract (e.g., .tag_name, .name, .published_at). The agent may need to read the file structure first or make assumptions about the schema.
| - name: Run Claude Code for sync analysis | ||
| if: steps.guard.outputs.skip != 'true' | ||
| uses: anthropics/claude-code-action@v1 | ||
| uses: ./ |
There was a problem hiding this comment.
uses: ./ invokes the composite action from the current repository instead of calling upstream directly.
This changes the behavior significantly:
- Previous: called
anthropics/claude-code-action@v1directly with an inline prompt - Now: calls the wrapper action with
prompt_dir: upstream-sync
The wrapper action's prompt composition step (action.yml:176-232) will look for prompts in .github/prompts/upstream-sync/*.md relative to the action path (${{ github.action_path }}), which when uses: ./ is specified, points to the repo root.
Verify that the prompt composition correctly resolves .github/prompts/upstream-sync/01-sync-task.md when invoked this way.
| do nothing — no branch, no commit, no PR. Just state that everything is | ||
| in sync. | ||
| prompt_dir: upstream-sync | ||
| claude_args: >- |
There was a problem hiding this comment.
The allowed tools list adds several bash commands (cat, sort, comm, diff, echo, grep, date), but the prompt instructs the agent to avoid these in favor of specialized tools.
From CLAUDE.md prompts:
"Avoid using Bash with the
find,grep,cat,head,tail,sed,awk, orechocommands... Instead, always prefer using the dedicated tools"
The upstream-sync prompt doesn't override this guidance. Consider whether these bash commands are actually needed for the sync task, or if the agent can use Read, Grep, etc. instead.
Use .tag_name and .published_at explicitly so the agent doesn't need to inspect the schema.
Moves the upstream-sync workflow's inline prompt into
.github/prompts/upstream-sync/01-sync-task.mdand changes the workflow to invoke the composite action wrapper (uses: ./) withprompt_dir: upstream-sync.This refactoring improves maintainability by separating prompt logic from workflow configuration, following the same pattern used for interactive and review modes.