Skip to content

Commit d476cab

Browse files
differentiate between when to run everything and only some
1 parent e7b677b commit d476cab

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515
- "utils/**/*.ts"
1616
- "utils/package.json"
1717
- "package.json"
18-
- "package-lock.json"
1918
- ".github/workflows/ci.yml"
2019
pull_request:
2120
branches: ["*"]
@@ -27,7 +26,6 @@ on:
2726
- "utils/**/*.ts"
2827
- "utils/**/package.json"
2928
- "package.json"
30-
- "package-lock.json"
3129
- ".github/workflows/ci.yml"
3230
types:
3331
- opened
@@ -117,10 +115,20 @@ jobs:
117115
- run: npm ci
118116

119117
- run: >
118+
changed_paths=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
119+
120+
# run everything?
121+
if echo "$changed_paths" | grep -qE '^(package\.json|\.github/workflows/ci\.yml)$'; then
122+
npm run test --workspaces
123+
exit 0
124+
fi
125+
126+
# run for specific workspace(s)
120127
npm run test $(
121-
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
122-
| grep '^recipes/'
123-
| cut -d/ -f1,2
128+
echo "$changed_paths" \
129+
| awk -F/ '
130+
/^packages\// { print "--workspace=" $1 "/" $2 }
131+
/^utils\// { print "--workspace=utils" }
132+
' \
124133
| sort -u
125-
| sed 's/^/--workspace=/'
126134
)

0 commit comments

Comments
 (0)