Skip to content

Commit a8c3655

Browse files
author
costefan
committed
get github_ref from env var
1 parent 7d94c59 commit a8c3655

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,12 @@ jobs:
167167
.join('\n');
168168
console.log('GitHub Context:', JSON.stringify(github, null, 2));
169169
console.log('Generated Docker images list:\n', dockerImages);
170-
const tagRef = github.event.ref;
171-
if (!tagRef) {
172-
throw new Error('No tag reference found. Make sure the action is triggered by a tag event.');
170+
// Use the GITHUB_REF environment variable to extract the tag name
171+
const tagRef = process.env.GITHUB_REF;
172+
if (!tagRef || !tagRef.startsWith('refs/tags/')) {
173+
throw new Error('GITHUB_REF does not contain a tag reference. Ensure this action runs on a tag event.');
173174
}
175+
174176
const tagName = tagRef.replace('refs/tags/', '');
175177
console.log('Tag name:', tagName);
176178
@@ -255,9 +257,10 @@ jobs:
255257
.join('\n');
256258
console.log('GitHub Context:', JSON.stringify(github, null, 2));
257259
console.log('Generated Docker images list:\n', dockerImages);
258-
const tagRef = github.event.ref;
259-
if (!tagRef) {
260-
throw new Error('No tag reference found. Make sure the action is triggered by a tag event.');
260+
// Use the GITHUB_REF environment variable to extract the tag name
261+
const tagRef = process.env.GITHUB_REF;
262+
if (!tagRef || !tagRef.startsWith('refs/tags/')) {
263+
throw new Error('GITHUB_REF does not contain a tag reference. Ensure this action runs on a tag event.');
261264
}
262265
263266
const tagName = tagRef.replace('refs/tags/', '');

0 commit comments

Comments
 (0)