Skip to content

Commit 0cc2836

Browse files
committed
ci: lint and test v-next packages lazily
1 parent 5d6c0cd commit 0cc2836

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

.github/workflows/v-next-ci.yml

+32-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches:
88
- "**"
99
paths:
10+
- ".github/workflows/v-next-ci.yml"
1011
- "v-next/**"
1112
- "config-v-next/**"
1213
workflow_dispatch:
@@ -42,16 +43,42 @@ jobs:
4243
name: List packages
4344
runs-on: ubuntu-latest
4445
outputs:
45-
packages: ${{ steps.list.outputs.packages }}
46+
packages: ${{ steps.filter.outputs.changes }}
4647
steps:
4748
- uses: actions/checkout@v4
48-
- id: list
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: 22
52+
- run: yq -p yaml -o json pnpm-lock.yaml | tee pnpm-lock.json
53+
- id: generate
54+
env:
55+
PACKAGE_IGNORE: |
56+
[
57+
".",
58+
"packages/",
59+
"v-next/example-project"
60+
]
61+
COMMON_FILTERS: |
62+
[
63+
".github/workflows/v-next-ci.yml",
64+
"config-v-next/**"
65+
]
4966
run: |
50-
echo "packages=$(ls -d v-next/* | xargs -n 1 basename | grep -v example-project | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
67+
echo "filters<<EOF" >> $GITHUB_OUTPUT
68+
node scripts/generate-filters.js |
69+
yq -Po yaml 'with_entries(.key |= sub("^v-next/", ""))' |
70+
tee -a $GITHUB_OUTPUT
71+
echo "EOF" >> $GITHUB_OUTPUT
72+
- id: filter
73+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
74+
with:
75+
filters: ${{ steps.generate.outputs.filters }}
5176

5277
lint:
5378
needs: list-packages
5479

80+
if: needs.list-packages.outputs.packages != '[]'
81+
5582
strategy:
5683
fail-fast: false
5784
matrix:
@@ -83,6 +110,8 @@ jobs:
83110
ci:
84111
needs: list-packages
85112

113+
if: needs.list-packages.outputs.packages != '[]'
114+
86115
strategy:
87116
fail-fast: false
88117
matrix:

0 commit comments

Comments
 (0)