Skip to content

Commit c838490

Browse files
committed
build/bake: enable fetch-by-commit for git contexts
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 589aff6 commit c838490

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/bake.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,9 @@ jobs:
413413
core.setFailed(`signing attestation manifests requires push to be enabled`);
414414
return;
415415
}
416-
417-
const bakeSource = await new Build().gitContext({subdir: inpContext});
416+
417+
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'};
418+
const bakeSource = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs});
418419
await core.group(`Set bake source`, async () => {
419420
core.info(bakeSource);
420421
});
@@ -810,7 +811,8 @@ jobs:
810811
};
811812
const renderTemplate = value => Util.compileHandlebars(value, {noEscape: true}, {meta});
812813
813-
const bakeSource = await new Build().gitContext({subdir: inpContext});
814+
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'};
815+
const bakeSource = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs});
814816
await core.group(`Set source output`, async () => {
815817
core.info(bakeSource);
816818
core.setOutput('source', bakeSource);

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,9 @@ jobs:
703703
704704
const renderTemplate = value => Util.compileHandlebars(value, {noEscape: true}, {meta});
705705
const toMultilineInput = value => value.split(/\r?\n/).map(line => line.trim()).filter(Boolean);
706-
707-
const buildContext = await new Build().gitContext({subdir: inpContext});
706+
707+
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'};
708+
const buildContext = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs});
708709
core.setOutput('context', buildContext);
709710
710711
switch (inpOutput) {

0 commit comments

Comments
 (0)