In some instances we need to tag commits for deployments, however the deployment might be unnecessary if the only file that has been changed in the commit is not app related, so you will be redeploying a no change package.
we can get the latest commit that has changed a specific file type using the following command:
GLOB_PATTERN="-- \apps/* -- \libs/* -- \*.tsx -- \*.ts -- \*.js -- \*.tf -- \*.json -- \*.yml -- \*.yaml"
GLOB_COMMIT=$(git log -n 1 --pretty=format:%H $GLOB_PATTERN)
the above command essentially gets the last commit hash where a file has been changed in the apps or libs folder, or if the commit has had a change to file with certain extensions.
we can also use the following command to delete any test tags that we have created:
git push -d origin $(git tag -l "test*")