Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add condition to not notify slack when don't have files in dags folder (#792)

Ilito Torquato758d4013f759
diff --git a/dag-sync.sh b/dag-sync.sh
index 0cbd38504..46c311b07 100755
--- a/dag-sync.sh
+++ b/dag-sync.sh
@@ -20,12 +20,17 @@ git fetch origin
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
+
# 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 "/dags/")
+# If there is no files under /dags/ folder, no need to notify, quit early
+[ -z "$have_dag" ] && exit
+
# Pull out the subject from the new commit
subject=$(git log -1 --format='%s')
-
if [ -z "$SLACK_URL" ]
then
echo "Slack hook was not supplied! Updates will not be posted"