Skip to content

Commit

Permalink
Add logging to all dag-sync exits (#4051)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend authored Apr 8, 2024
1 parent 852e6b7 commit d57b1d4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dag-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@ git fetch origin
# Get new commit hash *one commit ahead* of this one
new=$(git rev-list --reverse --topo-order HEAD..origin/main | head -1)
# If there is no new commit hash to move to, nothing has changed, quit early
[ -z "$new" ] && exit
if [ -z "$new" ]; then
echo "No new commits, nothing has changed, nothing to do."
exit
fi

# Move ahead to this new commit
git reset --hard "$new"
# Verify if have /dags/ in the last commit
have_dag=$(git log -p -1 "$new" --pretty=format: --name-only | grep "catalog/dags/")
# If there is no files under /dags/ folder, no need to notify, quit early
[ -z "$have_dag" ] && exit
if [ -z "$have_dag" ]; then
echo "No changes to DAGs, nothing to do."
exit
fi

# Pull out the subject from the new commit
subject=$(git log -1 --format='%s')
Expand Down

0 comments on commit d57b1d4

Please sign in to comment.