From 0d9a08dcfb60237b4b3ed3969da06aa86696dc71 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 11 Jun 2026 10:59:47 +0200 Subject: [PATCH] build/bake: preserve tag refs in git contexts Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/bake.yml | 4 ++-- .github/workflows/build.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index 0c59d5a7..5dc94a98 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -435,7 +435,7 @@ jobs: return; } - const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'}; + const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {checksum: GitHub.context.sha} : {'fetch-by-commit': 'true'}; const bakeSource = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs}); await core.group(`Set bake source`, async () => { core.info(bakeSource); @@ -855,7 +855,7 @@ jobs: }; const renderTemplate = value => Util.compileHandlebars(value, {noEscape: true}, {meta}); - const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'}; + const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {checksum: GitHub.context.sha} : {'fetch-by-commit': 'true'}; const bakeSource = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs}); await core.group(`Set source output`, async () => { core.info(bakeSource); diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a136975..485d63d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -748,7 +748,7 @@ jobs: const renderTemplate = value => Util.compileHandlebars(value, {noEscape: true}, {meta}); const toMultilineInput = value => value.split(/\r?\n/).map(line => line.trim()).filter(Boolean); - const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {} : {'fetch-by-commit': 'true'}; + const gitContextAttrs = GitHub.context.ref.startsWith('refs/tags/') ? {checksum: GitHub.context.sha} : {'fetch-by-commit': 'true'}; const buildContext = await new Build().gitContext({subdir: inpContext, attrs: gitContextAttrs}); core.setOutput('context', buildContext);