fix: problem with the sites discovery
This commit is contained in:
@@ -21,12 +21,12 @@ jobs:
|
||||
|
||||
- id: detect
|
||||
run: |
|
||||
all_sites=$(find sites -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | sort | jq -sRc '.')
|
||||
all_sites=$(find sites -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | sort | jq -Rc 'select(. != "")' | jq -sc '.')
|
||||
if git diff HEAD~1...HEAD --name-only | grep -qE '^(modules/|backend\.hcl)'; then
|
||||
echo "has-changes=true" >> $GITHUB_OUTPUT
|
||||
echo "matrix={\"site\": $all_sites}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
changed=$(git diff HEAD~1...HEAD --name-only | grep '^sites/' | cut -d/ -f2 | sort -u | jq -sRc '.')
|
||||
changed=$(git diff HEAD~1...HEAD --name-only | grep '^sites/' | cut -d/ -f2 | sort -u | jq -Rc 'select(. != "")' | jq -sc '.')
|
||||
if [ "$changed" = "[]" ] || [ -z "$changed" ]; then
|
||||
echo "has-changes=false" >> $GITHUB_OUTPUT
|
||||
echo "matrix={\"site\": []}" >> $GITHUB_OUTPUT
|
||||
|
||||
@@ -22,12 +22,12 @@ jobs:
|
||||
|
||||
- id: detect
|
||||
run: |
|
||||
all_sites=$(find sites -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | sort | jq -sRc '.')
|
||||
all_sites=$(find sites -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | sort | jq -Rc 'select(. != "")' | jq -sc '.')
|
||||
if git diff origin/main...HEAD --name-only | grep -qE '^(modules/|backend\.hcl)'; then
|
||||
echo "has-changes=true" >> $GITHUB_OUTPUT
|
||||
echo "matrix={\"site\": $all_sites}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
changed=$(git diff origin/main...HEAD --name-only | grep '^sites/' | cut -d/ -f2 | sort -u | jq -sRc '.')
|
||||
changed=$(git diff origin/main...HEAD --name-only | grep '^sites/' | cut -d/ -f2 | sort -u | jq -Rc 'select(. != "")' | jq -sc '.')
|
||||
if [ "$changed" = "[]" ] || [ -z "$changed" ]; then
|
||||
echo "has-changes=false" >> $GITHUB_OUTPUT
|
||||
echo "matrix={\"site\": []}" >> $GITHUB_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user