fix: wire allowed_tools/disallowed_tools inputs through to Claude SDK
The disallowed tools env var read in run.ts was DISALLOWED_TOOLS_INPUT (raw user input) instead of DISALLOWED_TOOLS (computed value including WebSearch/WebFetch defaults). This meant default tool disallowance was never enforced. Also removes orphaned ALLOWED_TOOLS env var export from createPrompt() (tag mode passes allowed tools via claudeArgs instead), extracts shared parseToolsInput utility to eliminate duplication, and adds tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
29a1032aa6
commit
df7afc08d4
7 files changed
+112
-8
No files matched your search
@@ -159,6 +159,37 @@ platform:
|
||||
|
||||
All other inputs work identically on both platforms. See the [Usage Guide](./usage.md) for the full list.
|
||||
|
||||
## Fork-Specific Fixes (All Platforms)
|
||||
|
||||
This fork fixes upstream bugs that affect **both GitHub and Forgejo** usage:
|
||||
|
||||
### `allowed_tools` / `disallowed_tools` inputs now work (upstream #181, #287, #724)
|
||||
|
||||
Upstream's `allowed_tools` and `disallowed_tools` inputs are completely broken — they are never wired through to Claude execution. This affects tag mode (the `@claude` mention flow) where the tool list is hardcoded and user inputs are silently ignored.
|
||||
|
||||
**What was broken:**
|
||||
|
||||
- `allowed_tools` was not defined in `action.yml`, so the env var was never set
|
||||
- Tag mode only merged `mcp__github_*` tools from `claude_args`, filtering out everything else
|
||||
- `run.ts` never passed `allowedTools`/`disallowedTools` to `runClaude()`
|
||||
- `createPrompt()` hardcoded `WebSearch` and `WebFetch` as disallowed with no way to override
|
||||
|
||||
**What this fork fixes:**
|
||||
|
||||
- Added `allowed_tools` and `disallowed_tools` as proper action inputs
|
||||
- User tools are merged into the tag-mode tool list
|
||||
- `disallowedTools` is passed through to the SDK
|
||||
- `WebSearch`/`WebFetch` are removed from the disallowed list when included in `allowed_tools`
|
||||
|
||||
**Usage:**
|
||||
|
||||
```yaml
|
||||
- uses: actions/claude-code-action@main
|
||||
with:
|
||||
allowed_tools: "WebSearch,WebFetch"
|
||||
# All other inputs as usual
|
||||
```
|
||||
|
||||
## Dedicated Bot User (Recommended)
|
||||
|
||||
On GitHub, Claude gets its own identity via the GitHub App (`claude[bot]`). On Forgejo, there's no such mechanism — by default the action runs under whatever token you provide, meaning commits and comments appear as the human user.
|
||||
|
||||
Reference in new issue
Block a user