@@ -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