Skip to content

Commit db6fbb9

Browse files
committed
Fix scope issue on GIT_SHA update
1 parent 1c79ddc commit db6fbb9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/actions/update-gitops/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ runs:
102102
fi
103103
104104
if [ -n "$GIT_SHA" ]; then
105-
sed -i "s|GIT_SHA: [^ ]*|GIT_SHA: $GIT_SHA|" "$FILE_PATH"
105+
if [ -n "$SWARM_SERVICE_NAME" ]; then
106+
sed -i "/^ ${SWARM_SERVICE_NAME}:/,/^ [^[:space:]]/ s|GIT_SHA: [^ ]*|GIT_SHA: $GIT_SHA|" "$FILE_PATH"
107+
else
108+
sed -i "s|GIT_SHA: [^ ]*|GIT_SHA: $GIT_SHA|" "$FILE_PATH"
109+
fi
106110
fi
107111
108112
git status

0 commit comments

Comments
 (0)