Skip to content

Instantly share code, notes, and snippets.

@flogy
Created August 28, 2025 16:33
Show Gist options
  • Select an option

  • Save flogy/de02c2d3dea4896a524077563fa09996 to your computer and use it in GitHub Desktop.

Select an option

Save flogy/de02c2d3dea4896a524077563fa09996 to your computer and use it in GitHub Desktop.
GitHub Actions Push Tags Trigger: Workaround for pushing more than 3 tags at once
/**
* MIT License
*
* Copyright (c) 2025 Florian Gyger <[email protected]>
* Date: 28.08.2025
*
* Description:
* This script looks for unpushed git tags and pushes them one by one.
* It works around the GitHub limitation that prevents triggering GitHub Action workflows
* when more than 3 tags are pushed at once.
*/
const { execSync } = require("child_process");
const localTags = execSync("git tag", { encoding: "utf8" })
.split("\n")
.filter(Boolean);
const remoteTags = execSync("git ls-remote --tags origin", { encoding: "utf8" })
.split("\n")
.map((line) => line.split("refs/tags/")[1])
.filter(Boolean);
const unpushedTags = localTags.filter((tag) => !remoteTags.includes(tag));
if (unpushedTags.length === 0) {
console.log("No unpushed tags found");
process.exit(0);
}
(async () => {
for (const tag of unpushedTags) {
console.log(`Pushing tag: ${tag}`);
execSync(`git push origin ${tag}`, { stdio: "inherit" });
await new Promise((res) => setTimeout(res, 1000));
}
console.log("Successfully pushed all tags");
})();
@flogy
Copy link
Author

flogy commented Aug 28, 2025

Can be executed using node ./push-tags.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment