Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions base-action/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#!/usr/bin/env bun

import * as core from "@actions/core";
import { $ } from "bun";
import { preparePrompt } from "./prepare-prompt";
import { runClaude } from "./run-claude";
import { setupClaudeCodeSettings } from "./setup-claude-code-settings";
import { validateEnvironmentVariables } from "./validate-env";
import { installPlugins } from "./install-plugins";

async function configureGitCredentials(token: string): Promise<void> {
// Configure a global git credential helper so that git clone operations
// (e.g. when installing plugin marketplaces from private repos) can
// authenticate using the provided GitHub token.
process.env.GH_TOKEN = token;
await $`git config --global credential.helper '!f() { echo "username=x-access-token"; echo "password=$GH_TOKEN"; }; f'`;
}

async function run() {
try {
validateEnvironmentVariables();
Expand All @@ -24,6 +33,13 @@ async function run() {
undefined, // homeDir
);

// Configure git credentials before installing plugins so that private
// marketplace repositories can be cloned successfully.
const githubToken = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
if (githubToken) {
await configureGitCredentials(githubToken);
}

// Install Claude Code plugins if specified
await installPlugins(
process.env.INPUT_PLUGIN_MARKETPLACES,
Expand Down