Compare commits

..

34 Commits

Author SHA1 Message Date
km-anthropic
665606ccf4 minor linting update again 2025-07-29 14:51:02 -07:00
km-anthropic
624adc1976 specify the type 2025-07-29 14:48:49 -07:00
km-anthropic
8207a5f128 bun format 2025-07-29 14:40:48 -07:00
km-anthropic
aaae231799 refactor: further simplify discriminated union implementation
- Add event name constants to reduce duplication
- Derive EntityEventName and AutomationEventName types from constants
- Use isAutomationContext consistently in agent mode and registry
- Simplify parseGitHubContext by removing redundant type assertions
- Extract payload casts to variables for cleaner code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 14:40:05 -07:00
km-anthropic
68e711968d some structural simplification 2025-07-29 14:32:28 -07:00
km-anthropic
5bdfd090e0 refactor: improve discriminated union implementation based on review feedback
- Use eventName checks instead of 'in' operator for more robust type guards
- Remove unnecessary type assertions - TypeScript's control flow analysis works correctly
- Remove redundant runtime checks for entityNumber and isPR
- Simplify code by using context directly after type guard

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 13:26:35 -07:00
km-anthropic
9c8ca262b6 More robust type checking 2025-07-29 13:21:58 -07:00
km-anthropic
21680fe730 update comment 2025-07-29 13:16:09 -07:00
km-anthropic
b1033b2ba1 refactor: implement discriminated unions for GitHub contexts
Split ParsedGitHubContext into entity-specific and automation contexts:
- ParsedGitHubContext: For entity events (issues/PRs) with required entityNumber and isPR
- AutomationContext: For workflow_dispatch/schedule events without entity fields
- GitHubContext: Union type for all contexts

This eliminates ~20 null checks throughout the codebase and provides better type safety.
Entity-specific code paths are now guaranteed to have the required fields.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 13:09:01 -07:00
km-anthropic
f1ce8b3d62 Merge branch 'main' of https://github.com/anthropics/claude-code-action into km/add-workflow-dispatch-schedule-support 2025-07-29 11:55:20 -07:00
km-anthropic
5146c656e8 linting update 2025-07-29 11:16:51 -07:00
km-anthropic
5da8dc78e6 fix: handle optional entityNumber for TypeScript
- Add runtime checks in files that require entityNumber
- These files are only used by tag mode which always has entityNumber
- Agent mode (workflow_dispatch/schedule) doesn't use these files
2025-07-29 11:16:09 -07:00
km-anthropic
1c2e7e788d Merge branch 'main' of https://github.com/anthropics/claude-code-action into km/add-workflow-dispatch-schedule-support 2025-07-29 11:08:07 -07:00
km-anthropic
b85d457dc6 remove unnecessary changes from PR
- Revert update-comment-link.ts changes (agent mode doesn't use this)
- Revert create-initial.ts changes (agent mode doesn't create comments)
- Remove unused default-branch.ts file
- Revert install-mcp-server.ts changes (agent mode uses minimal MCP)

These files are only used by tag mode for entity-based events, not needed
for workflow_dispatch/schedule support via agent mode.
2025-07-29 11:06:24 -07:00
km-anthropic
3ebb5202a2 remove unnecessary changes 2025-07-29 11:01:38 -07:00
km-anthropic
3402c5355d simplify PR by making agent mode only work with workflow dispatch and schedule events 2025-07-29 10:46:44 -07:00
km-anthropic
26d6ecc65d simplify: remove workflow_dispatch/schedule from create-prompt
- Remove workflow_dispatch and schedule event handling from create-prompt
  since agent mode doesn't use the standard prompt generation flow
- Enforce mode compatibility at selection time in the registry instead
  of runtime validation in tag mode
- Add explanatory comment in agent mode about why prompt file is needed
- Update tests to reflect simplified event handling

This reduces code duplication and makes the separation between tag mode
(entity-based events) and agent mode (automation events) clearer.
2025-07-29 10:15:22 -07:00
km-anthropic
859e93f18e ensure tag mode can't work with workflow dispatch and schedule tasks 2025-07-29 09:38:00 -07:00
km-anthropic
96970dfa2d refactor: simplify prepare logic with mode-specific implementations 2025-07-29 08:56:26 -07:00
km-anthropic
11d4e4c175 minor lint update 2025-07-28 12:28:57 -07:00
km-anthropic
bde5e40caf update workflow dispatch agent example 2025-07-28 12:27:05 -07:00
km-anthropic
6dbeb928d1 minor lint update 2025-07-28 12:21:12 -07:00
km-anthropic
cc8c99b7b4 Merge branch 'main' of https://github.com/anthropics/claude-code-action into km/add-workflow-dispatch-schedule-support 2025-07-28 12:19:37 -07:00
km-anthropic
aa2ef8067e remove test workflow dispatch file 2025-07-28 12:03:45 -07:00
km-anthropic
a433016152 Update workflow to use correct branch reference 2025-07-28 11:53:48 -07:00
km-anthropic
7a53e0529b Add test workflow for workflow_dispatch functionality 2025-07-28 11:52:52 -07:00
km-anthropic
dfe00d37c1 tests 2025-07-28 11:49:30 -07:00
km-anthropic
999dd8a3b6 add schedule & workflow dispatch paths. Also make prepare logic conditional 2025-07-28 11:28:06 -07:00
km-anthropic
a53ce607e4 Fix missed tracking comment to be false 2025-07-24 13:25:26 -07:00
km-anthropic
02c804a6be Update to say beta instead of main 2025-07-24 13:23:55 -07:00
km-anthropic
cda7d07f95 minor formatting issue 2025-07-24 12:31:20 -07:00
km-anthropic
65bfefd6c4 Since workflow_dispatch isn't in the base action, update the examples accordingly 2025-07-24 10:11:40 -07:00
km-anthropic
4a6d3cf183 Minor update to readme (from @main to @beta) 2025-07-24 08:35:25 -07:00
km-anthropic
3fef2d3f20 feat: add agent mode for automation scenarios
- Add agent mode that always triggers without checking for mentions
- Implement Mode interface with support for mode-specific tool configuration
- Add getAllowedTools() and getDisallowedTools() methods to Mode interface
- Simplify tests by combining related test cases
- Update documentation and examples to include agent mode
- Fix TypeScript imports to prevent circular dependencies

Agent mode is designed for automation and workflow_dispatch scenarios
where Claude should always run without requiring trigger phrases.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 00:01:40 -07:00
3 changed files with 3 additions and 6 deletions

View File

@@ -172,7 +172,7 @@ runs:
echo "Base-action dependencies installed"
cd -
# Install Claude Code globally
bun install -g @anthropic-ai/claude-code@1.0.63
bun install -g @anthropic-ai/claude-code@1.0.62
- name: Setup Network Restrictions
if: steps.prepare.outputs.contains_trigger == 'true' && inputs.experimental_allowed_domains != ''

View File

@@ -115,7 +115,7 @@ runs:
- name: Install Claude Code
shell: bash
run: bun install -g @anthropic-ai/claude-code@1.0.63
run: bun install -g @anthropic-ai/claude-code@1.0.62
- name: Run Claude Code Action
shell: bash

View File

@@ -1,5 +1,5 @@
import * as core from "@actions/core";
import { GITHUB_API_URL, GITHUB_SERVER_URL } from "../github/api/config";
import { GITHUB_API_URL } from "../github/api/config";
import type { ParsedGitHubContext } from "../github/context";
import { Octokit } from "@octokit/rest";
@@ -156,13 +156,10 @@ export async function prepareMcpConfig(
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITHUB_HOST",
"ghcr.io/github/github-mcp-server:sha-efef8ae", // https://github.com/github/github-mcp-server/releases/tag/v0.9.0
],
env: {
GITHUB_PERSONAL_ACCESS_TOKEN: githubToken,
GITHUB_HOST: GITHUB_SERVER_URL,
},
};
}