mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-23 23:14:13 +08:00
Compare commits
7 Commits
ashwin/rmn
...
ashwin/tes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
851ffa401e | ||
|
|
4ebee54a00 | ||
|
|
ef8c0a650e | ||
|
|
dd49718216 | ||
|
|
be4b56e1ea | ||
|
|
dfef61fdee | ||
|
|
5218d84d4f |
52
.github/workflows/release.yml
vendored
52
.github/workflows/release.yml
vendored
@@ -122,35 +122,35 @@ jobs:
|
|||||||
token: ${{ secrets.CLAUDE_CODE_BASE_ACTION_PAT }}
|
token: ${{ secrets.CLAUDE_CODE_BASE_ACTION_PAT }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Create and push tag
|
# - name: Create and push tag
|
||||||
run: |
|
# run: |
|
||||||
next_version="${{ needs.create-release.outputs.next_version }}"
|
# next_version="${{ needs.create-release.outputs.next_version }}"
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
# git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
# git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
# Create the version tag
|
# # Create the version tag
|
||||||
git tag -a "$next_version" -m "Release $next_version - synced from claude-code-action"
|
# git tag -a "$next_version" -m "Release $next_version - synced from claude-code-action"
|
||||||
git push origin "$next_version"
|
# git push origin "$next_version"
|
||||||
|
|
||||||
# Update the beta tag
|
# # Update the beta tag
|
||||||
git tag -fa beta -m "Update beta tag to ${next_version}"
|
# git tag -fa beta -m "Update beta tag to ${next_version}"
|
||||||
git push origin beta --force
|
# git push origin beta --force
|
||||||
|
|
||||||
- name: Create GitHub release
|
# - name: Create GitHub release
|
||||||
env:
|
# env:
|
||||||
GH_TOKEN: ${{ secrets.CLAUDE_CODE_BASE_ACTION_PAT }}
|
# GH_TOKEN: ${{ secrets.CLAUDE_CODE_BASE_ACTION_PAT }}
|
||||||
run: |
|
# run: |
|
||||||
next_version="${{ needs.create-release.outputs.next_version }}"
|
# next_version="${{ needs.create-release.outputs.next_version }}"
|
||||||
|
|
||||||
# Create the release
|
# # Create the release
|
||||||
gh release create "$next_version" \
|
# gh release create "$next_version" \
|
||||||
--repo anthropics/claude-code-base-action \
|
# --repo anthropics/claude-code-base-action \
|
||||||
--title "$next_version" \
|
# --title "$next_version" \
|
||||||
--notes "Release $next_version - synced from anthropics/claude-code-action" \
|
# --notes "Release $next_version - synced from anthropics/claude-code-action" \
|
||||||
--latest=false
|
# --latest=false
|
||||||
|
|
||||||
# Update beta release to be latest
|
# # Update beta release to be latest
|
||||||
gh release edit beta \
|
# gh release edit beta \
|
||||||
--repo anthropics/claude-code-base-action \
|
# --repo anthropics/claude-code-base-action \
|
||||||
--latest
|
# --latest
|
||||||
|
|||||||
24
.github/workflows/update-major-tag.yml
vendored
24
.github/workflows/update-major-tag.yml
vendored
@@ -1,24 +0,0 @@
|
|||||||
name: Update Beta Tag
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-beta-tag:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Update beta tag
|
|
||||||
run: |
|
|
||||||
# Get the current release version
|
|
||||||
VERSION=${GITHUB_REF#refs/tags/}
|
|
||||||
|
|
||||||
# Update the beta tag to point to this release
|
|
||||||
git config user.name github-actions[bot]
|
|
||||||
git config user.email github-actions[bot]@users.noreply.github.com
|
|
||||||
git tag -fa beta -m "Update beta tag to ${VERSION}"
|
|
||||||
git push origin beta --force
|
|
||||||
2
.npmrc
Normal file
2
.npmrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
engine-strict=true
|
||||||
|
registry=https://registry.npmjs.org/
|
||||||
@@ -157,7 +157,7 @@ runs:
|
|||||||
# Install Claude Code if no custom executable is provided
|
# Install Claude Code if no custom executable is provided
|
||||||
if [ -z "${{ inputs.path_to_claude_code_executable }}" ]; then
|
if [ -z "${{ inputs.path_to_claude_code_executable }}" ]; then
|
||||||
echo "Installing Claude Code..."
|
echo "Installing Claude Code..."
|
||||||
curl -fsSL https://claude.ai/install.sh | bash -s 1.0.92
|
curl -fsSL https://claude.ai/install.sh | bash -s 1.0.93
|
||||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
else
|
else
|
||||||
echo "Using custom Claude Code executable: ${{ inputs.path_to_claude_code_executable }}"
|
echo "Using custom Claude Code executable: ${{ inputs.path_to_claude_code_executable }}"
|
||||||
|
|||||||
2
base-action/.npmrc
Normal file
2
base-action/.npmrc
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
engine-strict=true
|
||||||
|
registry=https://registry.npmjs.org/
|
||||||
@@ -99,7 +99,7 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
if [ -z "${{ inputs.path_to_claude_code_executable }}" ]; then
|
if [ -z "${{ inputs.path_to_claude_code_executable }}" ]; then
|
||||||
echo "Installing Claude Code..."
|
echo "Installing Claude Code..."
|
||||||
curl -fsSL https://claude.ai/install.sh | bash -s 1.0.92
|
curl -fsSL https://claude.ai/install.sh | bash -s 1.0.93
|
||||||
else
|
else
|
||||||
echo "Using custom Claude Code executable: ${{ inputs.path_to_claude_code_executable }}"
|
echo "Using custom Claude Code executable: ${{ inputs.path_to_claude_code_executable }}"
|
||||||
# Add the directory containing the custom executable to PATH
|
# Add the directory containing the custom executable to PATH
|
||||||
|
|||||||
@@ -12,10 +12,23 @@ import {
|
|||||||
import type { ParsedGitHubContext } from "../context";
|
import type { ParsedGitHubContext } from "../context";
|
||||||
|
|
||||||
export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
||||||
|
console.log("checkContainsTrigger called with context:", {
|
||||||
|
eventName: context.eventName,
|
||||||
|
eventAction: context.eventAction,
|
||||||
|
inputs: context.inputs,
|
||||||
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
inputs: { assigneeTrigger, labelTrigger, triggerPhrase, prompt },
|
inputs: { assigneeTrigger, labelTrigger, triggerPhrase, prompt },
|
||||||
} = context;
|
} = context;
|
||||||
|
|
||||||
|
console.log("Extracted inputs:", {
|
||||||
|
assigneeTrigger,
|
||||||
|
labelTrigger,
|
||||||
|
triggerPhrase,
|
||||||
|
prompt,
|
||||||
|
});
|
||||||
|
|
||||||
// If prompt is provided, always trigger
|
// If prompt is provided, always trigger
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
console.log(`Prompt provided, triggering action`);
|
console.log(`Prompt provided, triggering action`);
|
||||||
@@ -46,15 +59,21 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
|||||||
|
|
||||||
// Check for issue body and title trigger on issue creation
|
// Check for issue body and title trigger on issue creation
|
||||||
if (isIssuesEvent(context) && context.eventAction === "opened") {
|
if (isIssuesEvent(context) && context.eventAction === "opened") {
|
||||||
|
console.log("Checking issue opened trigger");
|
||||||
const issueBody = context.payload.issue.body || "";
|
const issueBody = context.payload.issue.body || "";
|
||||||
const issueTitle = context.payload.issue.title || "";
|
const issueTitle = context.payload.issue.title || "";
|
||||||
|
console.log("Issue content:", { issueBody, issueTitle });
|
||||||
|
|
||||||
// Check for exact match with word boundaries or punctuation
|
// Check for exact match with word boundaries or punctuation
|
||||||
const regex = new RegExp(
|
const regex = new RegExp(
|
||||||
`(^|\\s)${escapeRegExp(triggerPhrase)}([\\s.,!?;:]|$)`,
|
`(^|\\s)${escapeRegExp(triggerPhrase)}([\\s.,!?;:]|$)`,
|
||||||
);
|
);
|
||||||
|
console.log("Regex pattern:", regex.toString());
|
||||||
|
|
||||||
// Check in body
|
// Check in body
|
||||||
if (regex.test(issueBody)) {
|
const bodyMatch = regex.test(issueBody);
|
||||||
|
console.log("Body match result:", bodyMatch);
|
||||||
|
if (bodyMatch) {
|
||||||
console.log(
|
console.log(
|
||||||
`Issue body contains exact trigger phrase '${triggerPhrase}'`,
|
`Issue body contains exact trigger phrase '${triggerPhrase}'`,
|
||||||
);
|
);
|
||||||
@@ -62,7 +81,9 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check in title
|
// Check in title
|
||||||
if (regex.test(issueTitle)) {
|
const titleMatch = regex.test(issueTitle);
|
||||||
|
console.log("Title match result:", titleMatch);
|
||||||
|
if (titleMatch) {
|
||||||
console.log(
|
console.log(
|
||||||
`Issue title contains exact trigger phrase '${triggerPhrase}'`,
|
`Issue title contains exact trigger phrase '${triggerPhrase}'`,
|
||||||
);
|
);
|
||||||
@@ -133,6 +154,7 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`No trigger was met for ${triggerPhrase}`);
|
console.log(`No trigger was met for ${triggerPhrase}`);
|
||||||
|
console.log("Returning false from checkContainsTrigger");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,16 @@ export const tagMode: Mode = {
|
|||||||
description: "Traditional implementation mode triggered by @claude mentions",
|
description: "Traditional implementation mode triggered by @claude mentions",
|
||||||
|
|
||||||
shouldTrigger(context) {
|
shouldTrigger(context) {
|
||||||
|
console.log("tagMode.shouldTrigger called");
|
||||||
// Tag mode only handles entity events
|
// Tag mode only handles entity events
|
||||||
if (!isEntityContext(context)) {
|
if (!isEntityContext(context)) {
|
||||||
|
console.log("Not entity context, returning false");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return checkContainsTrigger(context);
|
console.log("Is entity context, calling checkContainsTrigger");
|
||||||
|
const result = checkContainsTrigger(context);
|
||||||
|
console.log("checkContainsTrigger returned:", result);
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
prepareContext(context, data) {
|
prepareContext(context, data) {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export const createMockAutomationContext = (
|
|||||||
|
|
||||||
const mergedInputs = overrides.inputs
|
const mergedInputs = overrides.inputs
|
||||||
? { ...defaultInputs, ...overrides.inputs }
|
? { ...defaultInputs, ...overrides.inputs }
|
||||||
: defaultInputs;
|
: { ...defaultInputs };
|
||||||
|
|
||||||
return { ...baseContext, ...overrides, inputs: mergedInputs };
|
return { ...baseContext, ...overrides, inputs: mergedInputs };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ describe("Tag Mode", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("shouldTrigger delegates to checkContainsTrigger", () => {
|
test("shouldTrigger delegates to checkContainsTrigger", () => {
|
||||||
|
console.log("enter test");
|
||||||
const contextWithTrigger = createMockContext({
|
const contextWithTrigger = createMockContext({
|
||||||
eventName: "issue_comment",
|
eventName: "issue_comment",
|
||||||
isPR: false,
|
isPR: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user