41 Commits

Author SHA1 Message Date
Mark Wylde
01c923b4bd Attempt to make this work 2025-05-31 01:13:13 +01:00
Mark Wylde
dea3e23b34 Attempt to make this work 2025-05-31 01:11:46 +01:00
Mark Wylde
45ee2dca55 Attempt to make this work 2025-05-31 01:10:59 +01:00
Mark Wylde
e2f737a753 Attempt to make this work 2025-05-31 01:05:34 +01:00
Mark Wylde
1c309c8d10 Attempt to make this work 2025-05-31 00:59:31 +01:00
Mark Wylde
5171232878 Attempt to make this work 2025-05-31 00:56:07 +01:00
Mark Wylde
ea134ca929 Attempt to make this work 2025-05-31 00:50:13 +01:00
Mark Wylde
72aa15ac4f Attempt to make this work 2025-05-31 00:44:27 +01:00
Mark Wylde
87a39e8fbc Attempt to make this work 2025-05-31 00:35:22 +01:00
Mark Wylde
44d513b712 Attempt to make this work 2025-05-31 00:16:57 +01:00
Mark Wylde
3afac506b2 Attempt to make this work 2025-05-31 00:13:14 +01:00
Mark Wylde
436046a0ff Attempt to make this work 2025-05-31 00:09:10 +01:00
Mark Wylde
12940797c7 Attempt to make this work 2025-05-31 00:05:18 +01:00
Mark Wylde
59a6b568a6 Attempt to make this work 2025-05-31 00:02:45 +01:00
Mark Wylde
ed04634119 Attempt to make this work 2025-05-30 23:59:23 +01:00
Mark Wylde
8de76049e1 Attempt to make this work 2025-05-30 23:55:03 +01:00
Mark Wylde
bbf8371776 Attempt to make this work 2025-05-30 22:52:37 +01:00
Mark Wylde
e1be245c51 Attempt to make this work 2025-05-30 22:46:03 +01:00
Mark Wylde
0bb118b1a2 Attempt to make this work 2025-05-30 22:44:19 +01:00
Mark Wylde
4b69e8485a Attempt to make this work 2025-05-30 22:41:48 +01:00
Mark Wylde
4b1c3d000d Attempt to make this work 2025-05-30 22:31:06 +01:00
Mark Wylde
b41b7ecd9f Attempt to make this work 2025-05-30 22:18:35 +01:00
Mark Wylde
11685fc8c1 Attempt to make this work 2025-05-30 22:11:20 +01:00
Mark Wylde
87c1a97c6e Attempt to make this work 2025-05-30 22:02:19 +01:00
Mark Wylde
7018095f9a Attempt to make this work 2025-05-30 21:54:22 +01:00
Mark Wylde
e079f18247 Attempt to make this work 2025-05-30 21:49:42 +01:00
Mark Wylde
c0d1a3fc4c Attempt to make this work 2025-05-30 21:47:12 +01:00
Mark Wylde
c77bb0e4b3 Attempt to make this work 2025-05-30 21:20:59 +01:00
Mark Wylde
01602be052 Attempt to make this work 2025-05-30 21:12:47 +01:00
Mark Wylde
f2f966c77e Attempt to make this work 2025-05-30 21:00:03 +01:00
Mark Wylde
80886e1c8e Attempt to make this work 2025-05-30 20:49:55 +01:00
Mark Wylde
e2d102aadd Attempt to make this work 2025-05-30 20:40:22 +01:00
Mark Wylde
c004bcdb83 Attempt to make this work 2025-05-30 20:37:47 +01:00
Mark Wylde
2f36d061b3 Attempt to make this work 2025-05-30 20:34:43 +01:00
Mark Wylde
9d64c62a2e Attempt to make this work 2025-05-30 20:32:40 +01:00
Mark Wylde
828076e411 Attempt to make this work 2025-05-30 20:29:15 +01:00
Mark Wylde
9986f4d1a3 Attempt to make this work 2025-05-30 20:25:16 +01:00
Mark Wylde
406208cf7a Attempt to make this work 2025-05-30 20:20:51 +01:00
Mark Wylde
6410e33591 Attempt to make this work 2025-05-30 20:17:34 +01:00
Mark Wylde
f598608bb4 Attempt to make this work 2025-05-30 20:10:31 +01:00
Mark Wylde
e474962b0d First attempt 2025-05-30 20:02:39 +01:00
8 changed files with 37 additions and 35 deletions

2
FAQ.md
View File

@@ -22,7 +22,7 @@ permissions:
id-token: write # Required for OIDC authentication
```
The OIDC token is required in order for the Claude GitHub app to function. If you wish to not use the GitHub app, you can instead provide a `gitea_token` input to the action for Claude to operate with. See the [Claude Code permissions documentation][perms] for more.
The OIDC token is required in order for the Claude GitHub app to function. If you wish to not use the GitHub app, you can instead provide a `github_token` input to the action for Claude to operate with. See the [Claude Code permissions documentation][perms] for more.
## Claude's Capabilities and Limitations

View File

@@ -56,7 +56,7 @@ Now required to explicitly provide a GitHub token:
# After (required)
- uses: anthropics/claude-code-action@beta
with:
gitea_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
```
@@ -94,7 +94,7 @@ jobs:
- name: Run Claude Assistant
uses: ./ # Adjust path as needed for your Gitea setup
with:
gitea_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
```

View File

@@ -58,10 +58,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: markwylde/claude-code-gitea-action@v1.0.1
- uses: markwylde/claude-code-gitea-action@v1.0.0
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
gitea_token: ${{ secrets.GITEA_TOKEN }}
github_token: ${{ secrets.GITEA_TOKEN }}
gitea_api_url: https://gitea.example.com
```
## Inputs
@@ -71,7 +72,8 @@ jobs:
| `anthropic_api_key` | Anthropic API key (required for direct API, not needed for Bedrock/Vertex) | No\* | - |
| `direct_prompt` | Direct prompt for Claude to execute automatically without needing a trigger (for automated workflows) | No | - |
| `timeout_minutes` | Timeout in minutes for execution | No | `30` |
| `gitea_token` | Gitea token for Claude to operate with. **Only include this if you're connecting a custom GitHub app of your own!** | No | - |
| `github_token` | GitHub token for Claude to operate with. **Only include this if you're connecting a custom GitHub app of your own!** | No | - |
| `gitea_api_url` | Gitea server URL (e.g., `https://gitea.example.com`) for Gitea installations. Leave empty for GitHub. | No | GitHub API |
| `model` | Model to use (provider-specific format required for Bedrock/Vertex) | No | - |
| `anthropic_model` | **DEPRECATED**: Use `model` instead. Kept for backward compatibility. | No | - |
| `use_bedrock` | Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API | No | `false` |
@@ -110,7 +112,8 @@ jobs:
- uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
gitea_token: ${{ secrets.GITEA_TOKEN }}
gitea_api_url: "https://gitea.example.com"
github_token: ${{ secrets.GITEA_TOKEN }}
```
### Gitea Setup Notes

View File

@@ -44,8 +44,11 @@ inputs:
anthropic_api_key:
description: "Anthropic API key (required for direct API, not needed for Bedrock/Vertex)"
required: false
gitea_token:
description: "Gitea token with repo and pull request permissions (defaults to GITHUB_TOKEN)"
github_token:
description: "GitHub token with repo and pull request permissions (defaults to GITHUB_TOKEN)"
required: false
gitea_api_url:
description: "Gitea server URL (e.g., https://gitea.example.com, defaults to GitHub API)"
required: false
use_bedrock:
description: "Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API"
@@ -92,10 +95,10 @@ runs:
ALLOWED_TOOLS: ${{ inputs.allowed_tools }}
CUSTOM_INSTRUCTIONS: ${{ inputs.custom_instructions }}
DIRECT_PROMPT: ${{ inputs.direct_prompt }}
OVERRIDE_GITHUB_TOKEN: ${{ inputs.gitea_token }}
OVERRIDE_GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
GITEA_API_URL: ${{ inputs.gitea_api_url }}
- name: Run Claude Code
id: claude-code
@@ -126,7 +129,7 @@ runs:
# GitHub token for repository access
GITHUB_TOKEN: ${{ steps.prepare.outputs.GITHUB_TOKEN }}
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
GITEA_API_URL: ${{ inputs.gitea_api_url }}
# Provider configuration (for future cloud provider support)
ANTHROPIC_BASE_URL: ${{ env.ANTHROPIC_BASE_URL }}
@@ -164,17 +167,13 @@ runs:
TRIGGER_USERNAME: ${{ github.event.comment.user.login || github.event.issue.user.login || github.event.pull_request.user.login || github.event.sender.login || github.triggering_actor || github.actor || '' }}
PREPARE_SUCCESS: ${{ steps.prepare.outcome == 'success' }}
PREPARE_ERROR: ${{ steps.prepare.outputs.prepare_error || '' }}
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
GITEA_API_URL: ${{ inputs.gitea_api_url }}
- name: Display Claude Code Report
if: steps.prepare.outputs.contains_trigger == 'true' && steps.claude-code.outputs.execution_file != ''
shell: bash
run: |
if [ -f "${{ steps.claude-code.outputs.execution_file }}" ]; then
echo "## Claude Code Report" >> $GITHUB_STEP_SUMMARY
echo '```json' >> $GITHUB_STEP_SUMMARY
cat "${{ steps.claude-code.outputs.execution_file }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Claude Code execution completed but no report file was generated" >> $GITHUB_STEP_SUMMARY
fi

View File

@@ -31,6 +31,6 @@ jobs:
- name: Run Claude PR Action
uses: anthropics/claude-code-action@beta
with:
gitea_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "60"

View File

@@ -31,7 +31,7 @@ jobs:
- name: Run Claude Assistant
uses: ./ # Use local action (adjust path as needed)
with:
gitea_token: ${{ secrets.GITHUB_TOKEN }} # Use standard workflow token
github_token: ${{ secrets.GITHUB_TOKEN }} # Use standard workflow token
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "60"
trigger_phrase: "@claude"

View File

@@ -1,14 +1,14 @@
// Derive API URL from server URL for Gitea instances
function deriveApiUrl(serverUrl: string): string {
if (serverUrl.includes("github.com")) {
return "https://api.github.com";
export const GITEA_API_URL =
process.env.GITEA_API_URL || "https://api.github.com";
// Derive server URL from API URL for Gitea instances
function deriveServerUrl(apiUrl: string): string {
if (apiUrl.includes("api.github.com")) {
return "https://github.com";
}
// For Gitea, add /api/v1 to the server URL to get the API URL
return `${serverUrl}/api/v1`;
// For Gitea, remove /api/v1 from the API URL to get the server URL
return apiUrl.replace(/\/api\/v1\/?$/, "");
}
export const GITEA_SERVER_URL =
process.env.GITHUB_SERVER_URL || "https://github.com";
export const GITEA_API_URL =
process.env.GITEA_API_URL || deriveApiUrl(GITEA_SERVER_URL);
process.env.GITEA_SERVER_URL || deriveServerUrl(GITEA_API_URL);

View File

@@ -23,11 +23,11 @@ export async function setupGitHubToken(): Promise<string> {
}
throw new Error(
"No GitHub token available. Please provide a gitea_token input or ensure GITHUB_TOKEN is available in the workflow environment.",
"No GitHub token available. Please provide a github_token input or ensure GITHUB_TOKEN is available in the workflow environment.",
);
} catch (error) {
core.setFailed(
`Failed to setup GitHub token: ${error}.\n\nPlease provide a \`gitea_token\` in the \`with\` section of the action in your workflow yml file, or ensure the workflow has access to the default GITHUB_TOKEN.`,
`Failed to setup GitHub token: ${error}.\n\nPlease provide a \`github_token\` in the \`with\` section of the action in your workflow yml file, or ensure the workflow has access to the default GITHUB_TOKEN.`,
);
process.exit(1);
}