Skip to content

Commit 5f637c8

Browse files
authored
Merge pull request #231 from crazy-max/fix-tag-git-context-checksum
build/bake: preserve tag refs in git contexts
2 parents 5f32361 + 0d9a08d commit 5f637c8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/bake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ jobs:
435435
return;
436436
}
437437
438-
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'};
438+
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {checksum: GitHub.context.sha} : {'fetch-by-commit': 'true'};
439439
const bakeSource = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs});
440440
await core.group(`Set bake source`, async () => {
441441
core.info(bakeSource);
@@ -855,7 +855,7 @@ jobs:
855855
};
856856
const renderTemplate = value => Util.compileHandlebars(value, {noEscape: true}, {meta});
857857
858-
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'};
858+
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {checksum: GitHub.context.sha} : {'fetch-by-commit': 'true'};
859859
const bakeSource = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs});
860860
await core.group(`Set source output`, async () => {
861861
core.info(bakeSource);

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ jobs:
748748
const renderTemplate = value => Util.compileHandlebars(value, {noEscape: true}, {meta});
749749
const toMultilineInput = value => value.split(/\r?\n/).map(line => line.trim()).filter(Boolean);
750750
751-
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'};
751+
const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {checksum: GitHub.context.sha} : {'fetch-by-commit': 'true'};
752752
const buildContext = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs});
753753
core.setOutput('context', buildContext);
754754

0 commit comments

Comments
 (0)