Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- run: cargo fmt --all --check

detect-secrets:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6.0.2
- name: Run detect-secrets
run: scripts/ci/detect-secrets.sh

clippy:
runs-on: ubuntu-latest
steps:
Expand Down
27 changes: 27 additions & 0 deletions scripts/ci/detect-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail

readonly BASELINE="${DETECT_SECRETS_BASELINE:-.secrets.baseline}"
readonly DETECT_SECRETS_SPEC="${DETECT_SECRETS_SPEC:-git+https://github.com/ibm/detect-secrets.git@076672a9a01abdfc7ecee2e7d14f08cdccb73976}"
readonly TEMP_ROOT="${RUNNER_TEMP:-${TMPDIR:-/tmp}}"
readonly VENV="${DETECT_SECRETS_VENV:-${TEMP_ROOT}/detect-secrets-venv}"

if [[ ! -f "${BASELINE}" ]]; then
if [[ "${GITHUB_ACTIONS:-false}" == "true" ]]; then
echo "::notice::detect-secrets enforcement will start when ${BASELINE} is added"
else
echo "detect-secrets: ${BASELINE} not found; skipping"
fi
exit 0
fi

python3 -m venv "${VENV}"
PIP_DISABLE_PIP_VERSION_CHECK=1 \
"${VENV}/bin/python" -m pip install --quiet "${DETECT_SECRETS_SPEC}"

git ls-files -z | xargs -0 \
"${VENV}/bin/detect-secrets-hook" \
--baseline "${BASELINE}" \
--use-all-plugins \
--fail-on-unaudited \
--
Loading