mirror of
https://github.com/markwylde/claude-code-gitea-action.git
synced 2026-02-20 02:22:49 +08:00
Attempt to make this work
This commit is contained in:
@@ -119,7 +119,7 @@ export async function setupBranch(
|
|||||||
|
|
||||||
console.log(`Current SHA: ${currentSHA}`);
|
console.log(`Current SHA: ${currentSHA}`);
|
||||||
|
|
||||||
// Create branch - try GitHub API first, fallback to Git CLI
|
// Create branch - try GitHub API first
|
||||||
try {
|
try {
|
||||||
await octokits.rest.git.createRef({
|
await octokits.rest.git.createRef({
|
||||||
owner,
|
owner,
|
||||||
@@ -128,21 +128,16 @@ export async function setupBranch(
|
|||||||
sha: currentSHA,
|
sha: currentSHA,
|
||||||
});
|
});
|
||||||
|
|
||||||
// If API creation succeeded, checkout the new branch
|
console.log(`Successfully created branch via API: ${newBranch}`);
|
||||||
await $`git fetch origin --depth=1 ${newBranch}`;
|
|
||||||
await $`git checkout ${newBranch}`;
|
|
||||||
} catch (createRefError: any) {
|
} catch (createRefError: any) {
|
||||||
// If git/refs creation fails (like in Gitea), fall back to Git CLI
|
// If git/refs creation fails (like in Gitea), that's expected
|
||||||
console.log(`git createRef failed, using Git CLI fallback: ${createRefError.message}`);
|
// We'll create the branch when we push files later
|
||||||
|
console.log(`git createRef failed (expected for Gitea): ${createRefError.message}`);
|
||||||
// Use Git CLI to create and checkout the branch locally, then push it
|
console.log(`Branch ${newBranch} will be created when files are pushed`);
|
||||||
await $`git checkout -b ${newBranch}`;
|
|
||||||
await $`git push origin ${newBranch}`;
|
|
||||||
console.log(`Created branch via Git CLI: ${newBranch}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`Successfully created and checked out new branch: ${newBranch}`,
|
`Branch setup completed for: ${newBranch}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set outputs for GitHub Actions
|
// Set outputs for GitHub Actions
|
||||||
|
|||||||
Reference in New Issue
Block a user