diff --git a/src/main.ts b/src/main.ts index cc049ef..84e0ac2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -61,17 +61,25 @@ async function run(): Promise { if (config.postprocess) { core.startGroup('Postprocess') - core.debug(`Invoking ${config.postprocess} with ${filename}...`) - try { - const raw = execSync( - `NO_COLOR=true deno run -q --allow-read --allow-write --allow-run --allow-net --allow-env --unstable ${config.postprocess} ${filename}` - ).toString() - - core.info('Deno output:') - core.info(raw) - } catch (error) { - core.setFailed(error) + + const changes = await execSync(`git diff ${filename}`).toString() + if (changes.length > 0) { + core.debug(`Invoking ${config.postprocess} with ${filename}...`) + try { + const raw = execSync( + `NO_COLOR=true deno run -q --allow-read --allow-write --allow-run --allow-net --allow-env --unstable ${config.postprocess} ${filename}` + ).toString() + + core.info('Deno output:') + core.info(raw) + } catch (error) { + core.setFailed(error) + } + } else { + core.debug(`Skipping ${config.postprocess} because there were no changes to ${filename}.`) } + + core.endGroup() }