Files
MapLibreParticleLab/.github/actions/tree-is-clean/action.yml
2026-07-10 00:23:02 +00:00

39 lines
1.1 KiB
YAML

name: tree-is-clean
description: "Check whether previous steps left the Git working tree clean"
inputs:
check_untracked:
description: "Fail on newly added files, or only on changes to tracked files"
required: false
default: "true"
runs:
using: "composite"
steps:
- name: Check Git working tree
shell: bash
env:
CHECK_UNTRACKED: ${{ inputs.check_untracked }}
run: |
set -euo pipefail
status_args=(status --porcelain)
if [ "${CHECK_UNTRACKED}" = "false" ]; then
status_args+=(-uno)
fi
status="$(git "${status_args[@]}")"
if [ -n "${status}" ]; then
printf '%s\n' "${status}"
message="These files have changed since checkout. Check for out-of-sync autogenerated files"
if [ "${CHECK_UNTRACKED}" != "false" ]; then
message="${message}, or for untracked files written inside the working tree"
fi
echo "::error::${message}"
echo "::group::Full diff:"
git diff
echo "::endgroup::"
exit 1
fi