32 lines
1 KiB
Text
Executable file
32 lines
1 KiB
Text
Executable file
#!/usr/bin/env nix-shell
|
|
#! nix-shell -i bash ../shell.nix
|
|
|
|
# Get current branch name
|
|
current_branch=$(git branch --show-current)
|
|
|
|
# Only perform actions if we're on main branch and a merge just completed
|
|
if [ "$current_branch" = "main" ]; then
|
|
echo "Post-merge on main branch - running nix flake check"
|
|
|
|
# Run nix flake check after merge into main
|
|
nix flake check
|
|
|
|
if [ ! $? -eq 0 ]; then
|
|
echo "Warning: nix flake check failed after merge into main"
|
|
echo "Please fix the issues as soon as possible"
|
|
else
|
|
echo "nix flake check passed after merge"
|
|
fi
|
|
|
|
# Check if there are any pre-commit stashes to restore
|
|
recent_stash=$(git stash list | grep "pre-commit-stash-" | head -n 1 | cut -d: -f1)
|
|
|
|
if [ -n "$recent_stash" ]; then
|
|
echo "Post-merge: restoring pre-commit stash on main branch"
|
|
git stash pop -q "$recent_stash"
|
|
else
|
|
echo "Post-merge: no pre-commit stash to restore on main branch"
|
|
fi
|
|
else
|
|
echo "Post-merge: no action needed on branch '$current_branch'"
|
|
fi
|