Skip to content

Commit 446e96e

Browse files
committed
ci: improve e2e tests
1 parent 8216dc2 commit 446e96e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/reusable-test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts" | \
4949
jq --arg name "$ARTIFACT_NAME" '.artifacts[] | select(.name == $name) | .id' | wc -l)
5050
51+
echo "artifact_exists=$ARTIFACT_EXISTS" >> $GITHUB_ENV
52+
5153
if [ "$ARTIFACT_EXISTS" -gt "0" ]; then
5254
echo "artifact_exists=true" >> $GITHUB_OUTPUT
5355
else
@@ -258,12 +260,33 @@ jobs:
258260
# - name: Build package
259261
# run: npm run build
260262

263+
- name: Check if artifact exists
264+
id: check_node_modules_artifact
265+
run: |
266+
ARTIFACT_NAME="modern-node-modules-${{ hashFiles('**/package-lock.json') }}"
267+
ARTIFACT_EXISTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
268+
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts" | \
269+
jq --arg name "$ARTIFACT_NAME" '.artifacts[] | select(.name == $name) | .id' | wc -l)
270+
271+
echo "artifact_exists=$ARTIFACT_EXISTS" >> $GITHUB_ENV
272+
273+
if [ "$ARTIFACT_EXISTS" -gt "0" ]; then
274+
echo "artifact_exists=true" >> $GITHUB_OUTPUT
275+
else
276+
echo "artifact_exists=false" >> $GITHUB_OUTPUT
277+
fi
278+
261279
- name: Download node_modules from artifacts
280+
if: steps.check_node_modules_artifact.outputs.artifact_exists == 'true'
262281
uses: actions/download-artifact@v4
263282
with:
264283
name: modern-node-modules-${{ hashFiles('**/package-lock.json') }}
265284
path: node_modules
266285

286+
- name: Install dependencies
287+
if: steps.check_node_modules_artifact.outputs.artifact_exists == 'false'
288+
run: npm ci
289+
267290
- name: ls
268291
run: ls -la node_modules/.bin
269292

0 commit comments

Comments
 (0)