thoughts on adding this to some (all?) of our GitHub Actions workflows?
- name: Check for uncommitted changes
run: |
if ! git diff-index --quiet HEAD -- ; then
echo "After running this workflow, the following files in git had uncommitted changes. (This workflow must not result in any checked-in files being changed!)"
git diff-index --name-only HEAD --
exit 1
fi
untracked_files=$(git ls-files --exclude-standard --others)
if [ -n "$untracked_files" ]; then
echo "Running this workflow created the following new untracked files which are not in .gitignore. (Running the workflow should not create any new files unless they are in .gitignore!)"
echo "$untracked_files"
exit 1
fi
:+1: I would put it in all workflows with a pull_request:
trigger. I'd also put it in a bash script to avoid clutter.
Last updated: Jul 06 2025 at 12:14 UTC