Conversation
Greptile SummaryThis PR adds a weekly scheduled GitHub Actions workflow ( The concept is sound and the overall structure is clean, but there are a few issues worth addressing before enabling this in production:
Confidence Score: 2/5
|
| cat <<'PROMPT' | claude -p --model sonnet --allowedTools "Read,Write,Edit,Bash" | ||
| Read /tmp/latest-models.json — it contains the 5 most recent models per | ||
| provider, sorted by release date. | ||
|
|
||
| Scan this entire codebase (excluding .github/workflows/) for ALL | ||
| mentions of specific AI model names or IDs (e.g. claude-sonnet-4-20250514, | ||
| gpt-4o, gemini-2.0-flash). This includes illustrative examples, prompts, | ||
| comments, and documentation — not just functional references. | ||
| Do NOT touch model aliases like "haiku", "sonnet", "opus" — those resolve | ||
| automatically and are intentional. | ||
|
|
||
| Compare found references against the latest models. The most recently | ||
| created non-preview model in each family is the current stable version. | ||
| Update any outdated ones to their current equivalents. Preserve intent — if a | ||
| small/fast model was used, pick the current small/fast model, not the largest. | ||
|
|
||
| If nothing is outdated, change nothing. | ||
|
|
||
| Write a summary of changes (with old → new table) to /tmp/update-summary.md. | ||
| PROMPT |
There was a problem hiding this comment.
Unrestricted Bash tool grants the agent arbitrary code execution
The agent is launched with --allowedTools "Read,Write,Edit,Bash", giving it full shell access in a CI environment where ANTHROPIC_API_KEY is injected via env. This means the agent could — intentionally or through a prompt injection attack — exfiltrate the secret, make arbitrary network requests, or run destructive commands on the runner.
Since the task is purely "read files, compare model names, edit files", the Bash tool is not needed. Removing it limits the agent's blast radius to file read/write operations only:
| cat <<'PROMPT' | claude -p --model sonnet --allowedTools "Read,Write,Edit,Bash" | |
| Read /tmp/latest-models.json — it contains the 5 most recent models per | |
| provider, sorted by release date. | |
| Scan this entire codebase (excluding .github/workflows/) for ALL | |
| mentions of specific AI model names or IDs (e.g. claude-sonnet-4-20250514, | |
| gpt-4o, gemini-2.0-flash). This includes illustrative examples, prompts, | |
| comments, and documentation — not just functional references. | |
| Do NOT touch model aliases like "haiku", "sonnet", "opus" — those resolve | |
| automatically and are intentional. | |
| Compare found references against the latest models. The most recently | |
| created non-preview model in each family is the current stable version. | |
| Update any outdated ones to their current equivalents. Preserve intent — if a | |
| small/fast model was used, pick the current small/fast model, not the largest. | |
| If nothing is outdated, change nothing. | |
| Write a summary of changes (with old → new table) to /tmp/update-summary.md. | |
| PROMPT | |
| cat <<'PROMPT' | claude -p --model sonnet --allowedTools "Read,Write,Edit" |
| - name: Check for changes | ||
| id: changes | ||
| run: | | ||
| if [ -n "$(git diff --name-only)" ]; then | ||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
| fi |
There was a problem hiding this comment.
New (untracked) files are invisible to git diff --name-only
git diff --name-only only reports changes to files that are already tracked by git. If the agent creates a brand-new file (e.g., writes a note or creates a file while using Bash), that file will not appear in the diff output and has_changes will never be set, so the PR creation step will be silently skipped.
Use git status --porcelain to capture both modified tracked files and new untracked files:
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [ -n "$(git diff --name-only)" ]; then | |
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | |
| fi |
| Scan this entire codebase (excluding .github/workflows/) for ALL | ||
| mentions of specific AI model names or IDs (e.g. claude-sonnet-4-20250514, | ||
| gpt-4o, gemini-2.0-flash). This includes illustrative examples, prompts, | ||
| comments, and documentation — not just functional references. | ||
| Do NOT touch model aliases like "haiku", "sonnet", "opus" — those resolve |
There was a problem hiding this comment.
Agent instructed to scan its own workflow file, risking self-modification
The prompt tells the agent to scan including .github/workflows/ — which includes this very file. The prompt itself contains a full model ID as an illustrative example (claude-sonnet-4-20250514). If that example becomes "outdated" by the agent's criteria, it will rewrite the prompt embedded in the workflow, silently changing the behaviour or breaking the heredoc on the next run.
Consider either:
- Excluding
.github/workflows/from the scan scope, or - Removing the concrete model-ID example from the prompt (replacing it with a placeholder like
<model-id>) so there is nothing for the agent to match.
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install Claude CLI | ||
| run: npm install -g @anthropic-ai/claude-code |
There was a problem hiding this comment.
Unpinned @anthropic-ai/claude-code version
Installing the package without a version pin means a breaking release could silently break the weekly workflow. Consider pinning to a known-good version:
| run: npm install -g @anthropic-ai/claude-code | |
| run: npm install -g @anthropic-ai/claude-code@latest |
Or pin a specific semver (e.g. @anthropic-ai/claude-code@1.x.x) to get reproducible runs and only update intentionally.
Adds a scheduled GitHub Action that runs weekly to scan the codebase for outdated AI model references and opens a PR to update them. Uses Claude CLI + OpenRouter model data.
Requires two repo secrets:
ANTHROPIC_API_KEYPAT(fine-grained token with contents, pull-requests, and workflows write access)