Skip to content

Instantly share code, notes, and snippets.

@farhad-taran
Created February 24, 2023 17:17
Show Gist options
  • Save farhad-taran/0cae77179671990ec17bb3ed9065182e to your computer and use it in GitHub Desktop.
Save farhad-taran/0cae77179671990ec17bb3ed9065182e to your computer and use it in GitHub Desktop.
skipping build steps based on commit messages

We run audit checks as part of our build pipelines, but sometimes it's not possible to fix package audit issues in a timely manner when a critical fix needs to be deployed, and having your build pipeline failing on audit checks and stopping the quick fix deployment is not ideal. The following is a script which would allow us to skip the audit steps only once if the last commit message contains skip-audit.

if ! git log -1 --stat | grep -q "skip-audit"; then 
    yarn audit --level high --groups dependencies
    exit $(( $? >= 8 ? 1 : 0 ))
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment