-
Notifications
You must be signed in to change notification settings - Fork 0
chore(upstream-sync): improve workflow and prompt handling #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1d688b0
cba8bd8
7d8af64
2c6a547
e374429
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| You are performing an automated upstream sync for a composite GitHub Action | ||
| that wraps `anthropics/claude-code-action@v1`. | ||
|
|
||
| Ignore any shared prompt instructions about PR reviews, pending reviews, comment | ||
| hygiene, or cleanup steps — those do not apply to this task. | ||
|
|
||
| ## Your task | ||
|
|
||
| Compare our wrapper action against the upstream action and update our files | ||
| to reflect any new, changed, or removed inputs/outputs. | ||
|
|
||
| ## Files to read | ||
|
|
||
| 1. `./action.yml` — our composite wrapper action | ||
| 2. `./README.md` — our documentation | ||
| 3. `/tmp/upstream/action.yml` — upstream action definition | ||
| 4. `/tmp/upstream/README.md` — upstream documentation | ||
| 5. `/tmp/upstream/release.json` — latest upstream release info | ||
| 6. `/tmp/upstream/commits.json` — recent upstream commits | ||
|
|
||
| ## What to compare | ||
|
|
||
| - **Inputs**: Every input in upstream's `action.yml` that we pass through | ||
| (i.e., appears in our `with:` block under "Run Claude Code"). Check for: | ||
| - New upstream inputs not yet in our `action.yml` → add them | ||
| - Removed upstream inputs still in our `action.yml` → remove them | ||
| - Changed descriptions or defaults → update ours to match | ||
| - **Outputs**: Every output in upstream's `action.yml`. Check for: | ||
| - New outputs → add pass-through in our `outputs:` section | ||
| - Removed outputs → remove from ours | ||
| - **README.md tables**: The "Action Inputs" and "Action Outputs" tables | ||
| must match what's in our `action.yml` after updates. | ||
|
|
||
| ## Rules | ||
|
|
||
| - Preserve our existing code style, comments, and section organisation. | ||
| - Preserve dual-org compatibility: never hardcode org names — use | ||
| `YOUR_ORG` in README examples and `$REPO_OWNER` in prompt files. | ||
| - Do NOT touch any files in `prompts/` — those are org-specific. | ||
| - Do NOT touch `.github/workflows/claude-interactive.yml` or | ||
| `.github/workflows/claude-review.yml` — those are consumer-facing. | ||
| - Do NOT modify `.github/workflows/upstream-sync.yml` (this workflow). | ||
| - Maintain the grouping comments in `action.yml` (e.g., `# Progress tracking`, | ||
| `# Triggers`, `# Branch settings`, etc.). | ||
| - For new inputs: place them in a logical group, matching upstream's order | ||
| where possible. Add them to the `with:` block in the "Run Claude Code" step. | ||
| - Keep our custom inputs (`mode`, `prompt_dir`, `pr_number`) that don't exist | ||
| upstream — these are part of our wrapper's API. | ||
|
|
||
| ## After making changes | ||
|
|
||
| If you made any meaningful changes: | ||
|
|
||
| 1. Ensure the `upstream-sync` label exists (idempotent): | ||
| `gh label create upstream-sync --description "Automated upstream sync" --color "0E8A16" --force` | ||
| 2. Determine today's date in YYYYMMDD format using `date +%Y%m%d`. | ||
| 3. Create a new branch: `claude/upstream-sync-<YYYYMMDD>` | ||
| 4. Stage and commit changes with message: | ||
| `chore: sync with upstream anthropics/claude-code-action` | ||
| 5. Push the branch: | ||
| `git push origin claude/upstream-sync-<YYYYMMDD>` | ||
| 6. Create a PR with: | ||
|
|
||
| ```bash | ||
| gh pr create \ | ||
| --title "chore: sync with upstream anthropics/claude-code-action" \ | ||
| --body "Automated sync of inputs, outputs, and documentation with upstream anthropics/claude-code-action. | ||
|
|
||
| ## Changes | ||
|
|
||
| <summarise what changed> | ||
|
|
||
| ## Upstream reference | ||
|
|
||
| From release.json, extract `.tag_name` (e.g. v1.0.52) and | ||
| `.published_at` for the date. Note: the v1 tag is a rolling tag that | ||
| tracks the latest patch release. Present both clearly, e.g.: | ||
|
|
||
| - **Patch version**: [v1.0.52](https://github.com/anthropics/claude-code-action/releases/tag/v1.0.52) (2026-02-15) | ||
| - **Rolling tag**: [v1](https://github.com/anthropics/claude-code-action/releases/tag/v1) | ||
| - [All releases](https://github.com/anthropics/claude-code-action/releases) | ||
|
|
||
| --- | ||
| *Created automatically by the upstream-sync workflow.*" \ | ||
| --label "upstream-sync" | ||
| ``` | ||
|
|
||
| If there are NO meaningful changes (our action already reflects upstream), | ||
| do nothing — no branch, no commit, no PR. Just state that everything is | ||
| in sync. | ||
|
|
||
| ## Reporting tool use issues | ||
|
|
||
| If any tool call is denied due to permission restrictions, report every | ||
| occurrence clearly in your final output. For each denied call, state: | ||
|
|
||
| - The tool name and the command you tried to run | ||
| - Why you needed it | ||
| - How you worked around it (or that you could not) | ||
|
|
||
| This information helps maintainers keep the `--allowedTools` list up to | ||
| date. Do not silently skip denied operations. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,96 +61,14 @@ jobs: | |
| gh api 'repos/anthropics/claude-code-action/commits?per_page=30' \ | ||
| > /tmp/upstream/commits.json | ||
|
|
||
| # Pre-compute date for consistent branch naming | ||
| echo "sync_date=$(date +%Y%m%d)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| echo "::notice::Upstream context fetched successfully." | ||
|
|
||
| - 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This changes the behavior significantly:
The wrapper action's prompt composition step (action.yml:176-232) will look for prompts in Verify that the prompt composition correctly resolves |
||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| prompt: | | ||
| You are performing an automated upstream sync for a composite GitHub Action | ||
| that wraps `anthropics/claude-code-action@v1`. | ||
|
|
||
| ## Your task | ||
|
|
||
| Compare our wrapper action against the upstream action and update our files | ||
| to reflect any new, changed, or removed inputs/outputs. | ||
|
|
||
| ## Files to read | ||
|
|
||
| 1. `./action.yml` — our composite wrapper action | ||
| 2. `./README.md` — our documentation | ||
| 3. `/tmp/upstream/action.yml` — upstream action definition | ||
| 4. `/tmp/upstream/README.md` — upstream documentation | ||
| 5. `/tmp/upstream/release.json` — latest upstream release info | ||
| 6. `/tmp/upstream/commits.json` — recent upstream commits | ||
|
|
||
| ## What to compare | ||
|
|
||
| - **Inputs**: Every input in upstream's `action.yml` that we pass through | ||
| (i.e., appears in our `with:` block under "Run Claude Code"). Check for: | ||
| - New upstream inputs not yet in our `action.yml` → add them | ||
| - Removed upstream inputs still in our `action.yml` → remove them | ||
| - Changed descriptions or defaults → update ours to match | ||
| - **Outputs**: Every output in upstream's `action.yml`. Check for: | ||
| - New outputs → add pass-through in our `outputs:` section | ||
| - Removed outputs → remove from ours | ||
| - **README.md tables**: The "Action Inputs" and "Action Outputs" tables | ||
| must match what's in our `action.yml` after updates. | ||
|
|
||
| ## Rules | ||
|
|
||
| - Preserve our existing code style, comments, and section organization. | ||
| - Preserve dual-org compatibility: never hardcode org names — use | ||
| `YOUR_ORG` in README examples and `$REPO_OWNER` in prompt files. | ||
| - Do NOT touch any files in `prompts/` — those are org-specific. | ||
| - Do NOT touch `.github/workflows/claude-interactive.yml` or | ||
| `.github/workflows/claude-review.yml` — those are consumer-facing. | ||
| - Do NOT modify `.github/workflows/upstream-sync.yml` (this workflow). | ||
| - Maintain the grouping comments in `action.yml` (e.g., `# Progress tracking`, | ||
| `# Triggers`, `# Branch settings`, etc.). | ||
| - For new inputs: place them in a logical group, matching upstream's order | ||
| where possible. Add them to the `with:` block in the "Run Claude Code" step. | ||
| - Keep our custom inputs (`mode`, `prompt_dir`, `pr_number`) that don't exist | ||
| upstream — these are part of our wrapper's API. | ||
|
|
||
| ## After making changes | ||
|
|
||
| If you made any meaningful changes: | ||
|
|
||
| 1. Ensure the `upstream-sync` label exists (idempotent): | ||
| `gh label create upstream-sync --description "Automated upstream sync" --color "0E8A16" --force` | ||
| 2. Create a new branch: `claude/upstream-sync-${{ steps.fetch.outputs.sync_date }}` | ||
| 3. Stage and commit changes with message: | ||
| `chore: sync with upstream anthropics/claude-code-action` | ||
| 4. Push the branch: | ||
| `git push origin claude/upstream-sync-${{ steps.fetch.outputs.sync_date }}` | ||
| 5. Create a PR with: | ||
| ``` | ||
| gh pr create \ | ||
| --title "chore: sync with upstream anthropics/claude-code-action" \ | ||
| --body "Automated sync of inputs, outputs, and documentation with upstream anthropics/claude-code-action. | ||
|
|
||
| ## Changes | ||
|
|
||
| <summarize what changed> | ||
|
|
||
| ## Upstream reference | ||
|
|
||
| <include latest release tag and date from release.json> | ||
|
|
||
| --- | ||
| *Created automatically by the upstream-sync workflow.*" \ | ||
| --label "upstream-sync" | ||
| ``` | ||
|
|
||
| If there are NO meaningful changes (our action already reflects upstream), | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The allowed tools list adds several bash commands ( From CLAUDE.md prompts:
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 |
||
| --max-turns 50 | ||
| --allowedTools "Read,Write,Edit,Glob,Grep,Bash(git:*),Bash(gh pr create:*),Bash(gh label create:*)" | ||
| --allowedTools "Read,Write,Edit,Glob,Grep,Bash(git:*),Bash(gh pr create:*),Bash(gh label create:*),Bash(cat:*),Bash(sort:*),Bash(comm:*),Bash(diff:*),Bash(echo:*),Bash(grep:*),Bash(date:*)" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prompt instructs the agent to compute
date +%Y%m%dat runtime, but the workflow previously pre-computed this value insteps.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: