Skip to content

Commit

Permalink
Only run fast-lint if the pushed branch is active
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Oct 21, 2023
1 parent 3a23cf9 commit 672001c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scripts/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,17 @@ if ! command -v "pixi" > /dev/null 2>&1; then
exit 1
fi

pixi run fast-lint
while read local_ref local_sha remote_ref remote_sha; do
# Extract the branch name from the local reference
branch_name=$(echo "$local_ref" | sed 's/^refs\/heads\///')

# Get the name of the currently active branch
active_branch=$(git symbolic-ref --short HEAD)

# Check if the pushed branch matches the active branch
if [ "$branch_name" = "$active_branch" ]; then
exec pixi run fast-lint
else
echo "Skipping fast-lint because the pushed branch ($branch_name) does not match the active branch ($active_branch)."
fi
done

0 comments on commit 672001c

Please sign in to comment.