Skip to content

Commit

Permalink
feat: add pre-commit check for internal branch
Browse files Browse the repository at this point in the history
  • Loading branch information
supersergiy committed Feb 2, 2024
1 parent b21af13 commit ed40344
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ repos:
stages: [commit]
language: system
entry: jupyter nbconvert --to notebook --ClearOutputPreprocessor.enabled=True --inplace
- repo: local
hooks:
- id: internal-is-on-main
name: internal-is-on-main
stages: [commit]
language: system
entry: ./check_submodule_version.sh
always_run: true

- repo: local
hooks:
- id: reveal_type
Expand Down
15 changes: 15 additions & 0 deletions check_submodule_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

SCRIPT_DIR=$(dirname "$0")
TARGET_DIR="$SCRIPT_DIR/zetta_utils/internal"

cd $TARGET_DIR

if git merge-base --is-ancestor HEAD origin/main; then
echo "Submodule's commit is on the main branch."
else
echo "Error: Submodule's commit is not on the main branch."
exit 1
fi

cd -

0 comments on commit ed40344

Please sign in to comment.