Skip to content
Merged
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
25 changes: 20 additions & 5 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,24 @@ export function run(): void {
baseRevision = mergeBase;
}
} catch (err: unknown) {
if (err instanceof Error) {
console.error('Error finding merge base:', err.message);
// If origin/baseRef fails, try just baseRef
try {
const mergeBase = execSync(`git merge-base "${baseRef}" HEAD`).toString().trim();
if (mergeBase) {
baseRevision = mergeBase;
}
} catch {
if (err instanceof Error) {
console.error('Error finding merge base:', err.message);
}
}
}

// Check if lockfile changed
try {
const diff = execSync(`git diff --name-only "${baseRevision}" HEAD`, {
const diffCommand = `git diff --name-only "${baseRevision}" HEAD`;
core.debug(`Running diff command: ${diffCommand}`);
const diff = execSync(diffCommand, {
maxBuffer: 50 * 1024 * 1024,
}).toString();
const changedFiles = diff
Expand Down Expand Up @@ -250,11 +260,16 @@ export function run(): void {
// Get base version of lockfile
let baseContent = '{}';
try {
baseContent = execSync(`git show "${baseRevision}:${lockfilePath}"`, {
const showCommand = `git show "${baseRevision}:${lockfilePath}"`;
core.debug(`Running show command: ${showCommand}`);
baseContent = execSync(showCommand, {
stdio: ['pipe', 'pipe', 'ignore'],
maxBuffer: 50 * 1024 * 1024,
}).toString();
} catch {
} catch (err: unknown) {
if (err instanceof Error) {
core.debug(`Error running git show: ${err.message}`);
}
// If it fails, baseContent remains '{}'
// This could happen if the file didn't exist in the base branch
}
Expand Down