push-tags-one-by-one.sh 691 B

12345678910111213141516
  1. #!/bin/bash
  2. # source: https://github.com/lerna/lerna/issues/2218#issuecomment-771876933
  3. # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
  4. # > "Note: An event will not be created when you create more than three tags at once."
  5. # GitHub workflows will not run if a commit includes more than 3 tags at once. This
  6. # fix pushes tags up one by one.
  7. # get all tags on this commit
  8. TAGS=$(git tag --points-at HEAD | cat)
  9. # only push tags one by one if there are more than 3
  10. if (($(echo "$TAGS"| wc -l) > 3))
  11. then
  12. echo "Pushing tags one by one to avoid GitHub webhook limit of 3"
  13. echo "$TAGS" | while read line ; do git push origin --no-follow-tags $line; done
  14. fi