From d427629aa3a492cbeb191d91d63c13168daccad9 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 16 Dec 2024 22:41:28 -0800 Subject: [PATCH] feat: add GITHUB_RUN_ID in tags --- src/docker.js | 4 ++++ src/docker.test.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/docker.js b/src/docker.js index caa8027..568b178 100644 --- a/src/docker.js +++ b/src/docker.js @@ -65,6 +65,10 @@ export function getDockerTags({ tags.add(makeDockerTag(['latest', ...tagChunks])); console.log('MAKE', makeDockerTag(['latest', ...tagChunks])); } + if (process.env.GITHUB_RUN_ID) { + tags.add(makeDockerTag([`GHA-${process.env.GITHUB_RUN_ID}`])); + } + return [...tags]; } diff --git a/src/docker.test.js b/src/docker.test.js index ea8ae80..13e9f28 100644 --- a/src/docker.test.js +++ b/src/docker.test.js @@ -12,6 +12,7 @@ jest.mock('./github.js', () => jest.fn().mockImplementation(() => NEW_REL)); beforeEach(() => { process.env.TEST_ENV = 'true'; process.env.DOCKERHUB_TOKEN = 'dummy'; + process.env.GITHUB_RUN_ID= '123'; }); afterEach(() => { @@ -68,7 +69,7 @@ describe('getDockerTags', () => { 'pull_request', PR_ID, false, - [`${REPO}:22e7c60-dev`, `${REPO}:${SHA}-dev`, `${REPO}:pr-${PR_ID}-dev`], + [`${REPO}:22e7c60-dev`, `${REPO}:${SHA}-dev`, `${REPO}:pr-${PR_ID}-dev`, `${REPO}:GHA-123`], ], // old releases [