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
16 changes: 15 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,21 @@ jobs:
run: bash tests/verify_history_privacy.sh

- name: Verify Git history privacy
run: python3 scripts/verify_history_privacy.py . "${GITHUB_SHA}"
shell: bash
run: |
set -euo pipefail
previous_tag="$(
git tag --sort=-version:refname |
grep -Fxv "${GITHUB_REF_NAME}" |
head -n 1
)"
if [[ -n "${previous_tag}" ]]; then
release_base="$(git merge-base "${previous_tag}" "${GITHUB_SHA}")"
revision="${release_base}..${GITHUB_SHA}"
else
revision="${GITHUB_SHA}"
fi
python3 scripts/verify_history_privacy.py . "${revision}"

binaries:
name: Build ${{ matrix.target }}
Expand Down
19 changes: 19 additions & 0 deletions tests/verify_history_privacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,23 @@ git -C "${repo}" reflog expire --expire=now --all
git -C "${repo}" gc --prune=now --quiet

python3 "${root}/scripts/verify_history_privacy.py" "${repo}" HEAD >/dev/null

git -C "${repo}" tag v0.1.0
mkdir -p "${repo}/docs"
printf '%s\n' 'release-safe' > "${repo}/docs/release.txt"
git -C "${repo}" add .
git -C "${repo}" commit -qm release-safe

git -C "${repo}" branch release-main
git -C "${repo}" checkout -q --detach v0.1.0
mkdir -p "${repo}/docs"
printf '%s\n' 'previous-release' > "${repo}/docs/previous-release.txt"
git -C "${repo}" add .
git -C "${repo}" commit -qm previous-release
git -C "${repo}" tag -f v0.1.0
git -C "${repo}" checkout -q release-main

release_base="$(git -C "${repo}" merge-base v0.1.0 HEAD)"
python3 "${root}/scripts/verify_history_privacy.py" \
"${repo}" "${release_base}..HEAD" >/dev/null
echo "ok: history privacy scanner rejects old leaks and accepts rewritten history"
Loading