Pushing more than three tags at once makes actions fail to execute #56152
-
Select Topic AreaQuestion BodyHi, So here is my setup: we use a monorepo to manage all of our applications. We have multiple npm packages and docker images and are using lerna to control versions, create changelogs, and more. Our docker images are published based on tags created by lerna, this has worked fine for some time, but after adding a new API in our monorepo we have started to see some weird behaviour. If more than 3 tags are created that need to trigger a GitHub action each, no actions are triggered at all. NOTE: We are using a custom PAT to push and it is working for 3 or fewer tags. I have googled for hours and read all relevant documentation i could find, but have not been able to find anything that explains the behaviour we are seeing. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
in 2024/06 actions are still not running at all when I push 4 tags at once from my IDE; I have to manually delete them and push again with two commands 2 and 2 again seoarateky after that |
Beta Was this translation helpful? Give feedback.
-
|
By default, GitHub Actions ignores workflow triggers when more than three tags are pushed simultaneously. You can find more details on this behavior here. At Safty, I have successfully addressed this issue by pushing newly created tags sequentially. The solution involves a JavaScript script that detects newly created tags on the running machine (whether it is a local machine or a CI runner) and then pushes each tag one by one. Consequently, GitHub will execute a new pipeline for each tag. Below is the script: // Since git only allows three tags to be pushed at a time,
// we need to publish tags in batches,
// so that GitHub Actions are triggered for each batch.
const { execSync } = require('child_process');
process.stdout.write('Fetching remote tags: ');
const remoteTags = getRemoteTags();
process.stdout.write(`${remoteTags.length} tags fetched\n`);
process.stdout.write('Reading remote tags: ');
const localTags = getLocalTags();
process.stdout.write(`${localTags.length} tags read\n`);
const unpublishedTags = localTags.filter((tag) => !remoteTags.includes(tag));
if (unpublishedTags.length === 0) {
console.log('No tags to push');
} else {
console.log(`Pushing ${unpublishedTags.length} tags:`);
unpublishedTags.forEach((tag) => {
process.stdout.write(`* ${tag}: `);
execSync(`git push origin ${tag}`, { stdio: 'pipe' });
process.stdout.write(`done\n`);
});
}
function getRemoteTags() {
try {
const stdout = execSync('git ls-remote --tags origin');
// stdout is a string with each tag reference on a new line
// split it into an array of tag references
const tagRefs = stdout.toString().split('\n').filter(Boolean);
// Each tag reference is a string that looks like this:
// '1234567890abcdef1234567890abcdef12345678 refs/tags/v1.0'
// We're interested in the part after 'refs/tags/', which is the tag name
return tagRefs
.map((ref) => `${ref.split('refs/tags/').pop()}`)
.filter((t) => !`${t}`.endsWith('^{}'));
} catch (e) {
throw Error('Failed to get remote tags');
}
}
function getLocalTags() {
try {
const stdout = execSync('git tag');
return stdout.toString().split('\n').filter(Boolean);
} catch (e) {
throw Error('Failed to get local tags');
}
}Executing the script: node ./script-name.jsSciprt's output: Fetching remote tags: 944 tags fetched
Reading remote tags: 950 tags read
Pushing 6 tags:
* @safty/package-a@0.0.1-next.3: done
* @safty/package-b@0.0.2-next.3: done
* @safty/package-c@0.0.3-next.0: done
* @safty/package-d@0.0.4-next.3: done
* @safty/package-e@0.0.5-next.0: done
* @safty/package-f@0.0.6-next.5: done |
Beta Was this translation helpful? Give feedback.
By default, GitHub Actions ignores workflow triggers when more than three tags are pushed simultaneously. You can find more details on this behavior here.
At Safty, I have successfully addressed this issue by pushing newly created tags sequentially. The solution involves a JavaScript script that detects newly created tags on the running machine (whether it is a local machine or a CI runner) and then pushes each tag one by one. Consequently, GitHub will execute a new pipeline for each tag. Below is the script: