mirror of
https://github.com/markwylde/claude-code-gitea-action.git
synced 2026-02-20 10:32:49 +08:00
Attempt to make this work
This commit is contained in:
@@ -94,14 +94,27 @@ export async function setupBranch(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Get the SHA of the source branch
|
// Get the SHA of the source branch
|
||||||
// For Gitea, use heads/ prefix like GitHub
|
// For Gitea, try using the branches endpoint instead of git/refs
|
||||||
|
let currentSHA: string;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// First try the GitHub-compatible git.getRef approach
|
||||||
const sourceBranchRef = await octokits.rest.git.getRef({
|
const sourceBranchRef = await octokits.rest.git.getRef({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
ref: `heads/${sourceBranch}`,
|
ref: `heads/${sourceBranch}`,
|
||||||
});
|
});
|
||||||
|
currentSHA = sourceBranchRef.data.object.sha;
|
||||||
const currentSHA = sourceBranchRef.data.object.sha;
|
} catch (gitRefError: any) {
|
||||||
|
// If git/refs fails (like in Gitea), use the branches endpoint
|
||||||
|
console.log(`git/refs failed, trying branches endpoint: ${gitRefError.message}`);
|
||||||
|
const branchResponse = await octokits.rest.repos.getBranch({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
branch: sourceBranch,
|
||||||
|
});
|
||||||
|
currentSHA = branchResponse.data.commit.sha;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`Current SHA: ${currentSHA}`);
|
console.log(`Current SHA: ${currentSHA}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user