Skip to content

Commit

Permalink
fix: catch expected exit code from --skip-if-unchanged
Browse files Browse the repository at this point in the history
Catch the expected process exit code of `42` for `flatpak-builder`
when passed `--skip-if-unchanged`.

cc #118
  • Loading branch information
andyholmes committed Feb 14, 2025
1 parent 69db751 commit 72c5df5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
18 changes: 13 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144162,11 +144162,16 @@ async function buildApplication(directory, manifest) {
if (core.getInput('gpg-sign'))
builderArgs.push(`--gpg-sign=${core.getInput('gpg-sign')}`);

await exec.exec('flatpak-builder', [
...builderArgs,
'_build',
manifest,
]);
try {
await exec.exec('flatpak-builder', [
...builderArgs,
'_build',
manifest,
]);
} catch {
if (process.exitCode === 42 && builderArgs.includes('--skip-if-unchanged'))
process.exitCode = 0;
}

if (!cacheId?.localeCompare(cacheKey, undefined, { sensitivity: 'accent' }))
await cache.saveCache([stateDir], cacheKey);
Expand Down Expand Up @@ -144341,6 +144346,9 @@ async function testApplication(directory, manifest) {
'_build',
manifest,
]);
} catch {
if (process.exitCode === 42 && builderArgs.includes('--skip-if-unchanged'))
process.exitCode = 0;
} finally {
dbusSession.kill();
}
Expand Down
18 changes: 13 additions & 5 deletions src/flatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,16 @@ async function buildApplication(directory, manifest) {
if (core.getInput('gpg-sign'))
builderArgs.push(`--gpg-sign=${core.getInput('gpg-sign')}`);

await exec.exec('flatpak-builder', [
...builderArgs,
'_build',
manifest,
]);
try {
await exec.exec('flatpak-builder', [
...builderArgs,
'_build',
manifest,
]);
} catch {
if (process.exitCode === 42 && builderArgs.includes('--skip-if-unchanged'))
process.exitCode = 0;
}

if (!cacheId?.localeCompare(cacheKey, undefined, { sensitivity: 'accent' }))
await cache.saveCache([stateDir], cacheKey);
Expand Down Expand Up @@ -383,6 +388,9 @@ async function testApplication(directory, manifest) {
'_build',
manifest,
]);
} catch {
if (process.exitCode === 42 && builderArgs.includes('--skip-if-unchanged'))
process.exitCode = 0;
} finally {
dbusSession.kill();
}
Expand Down

0 comments on commit 72c5df5

Please sign in to comment.