test-repo/.gitea/workflows/txt-hashes.yml

42 lines
1.1 KiB
YAML

name: Hash all .txt files
on:
push:
branches:
- main
jobs:
txt_hashes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute SHA-256 hashes for all .txt files
shell: bash
run: |
set -euo pipefail
# Find all .txt files, sort deterministically, hash each, and output "hash path"
# Then hash the manifest itself so you can compare runs easily.
manifest="txt_sha256_manifest.txt"
find . -type f -name '*.txt' -print0 \
| LC_ALL=C sort -z \
| xargs -0 sha256sum \
| sed 's|^\([0-9a-f]\+\) \./|\1 |' \
> "${manifest}"
echo "---- Manifest (${manifest}) ----"
cat "${manifest}"
echo "---- Manifest SHA-256 ----"
sha256sum "${manifest}"
# Optional: keep the manifest as a downloadable artifact (if your Gitea Actions setup supports artifacts)
# - name: Upload manifest artifact
# uses: actions/upload-artifact@v4
# with:
# name: txt-sha256-manifest
# path: txt_sha256_manifest.txt