trufflesecurity / trufflehog

Find, verify, and analyze leaked credentials
https://trufflesecurity.com
GNU Affero General Public License v3.0
15.83k stars 1.65k forks source link

fix: Github CI example fails with single quote #2979

Open McPatate opened 3 months ago

McPatate commented 3 months ago

Description:

I am proposing a fix for the CI example in the README.

When someone commits a message containing a ', the CI will error given the raw JSON is simply enclosed with single quotes:

jq length <<< '${{ toJson(github.event.commits) }}'

cf https://github.com/huggingface/huggingface.js/pull/754 for more context

Checklist:

CLAassistant commented 3 months ago

CLA assistant check
All committers have signed the CLA.

dustin-decker commented 3 months ago

What about this? Seems cleaner to not have a temp file or the Env: part of the config:

depth=$(($(jq length <<< "${{ toJson(github.event.commits) }}") + 2))
echo "depth=$depth" >> $GITHUB_ENV