Skip to content

Commit d3e5b08

Browse files
committed
ci: improve e2e tests
1 parent 50e7106 commit d3e5b08

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

.github/workflows/reusable-test.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,25 @@ jobs:
6363
path: node_modules
6464
key: ${{ runner.os }}-modern-node-modules-${{ hashFiles('**/package-lock.json') }}
6565

66+
- name: Check if artifact exists
67+
id: check_node_modules_artifact
68+
run: |
69+
ARTIFACT_NAME="modern-node-modules-${{ hashFiles('**/package-lock.json') }}"
70+
ARTIFACT_EXISTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
71+
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts" | \
72+
jq --arg name "$ARTIFACT_NAME" '.artifacts[] | select(.name == $name) | .id' | wc -l)
73+
74+
if [ "$ARTIFACT_EXISTS" -gt "0" ]; then
75+
echo "artifact_exists=true" >> $GITHUB_OUTPUT
76+
else
77+
echo "artifact_exists=false" >> $GITHUB_OUTPUT
78+
fi
79+
6680
- name: Upload node_modules to artifacts
67-
if: steps.node_modules_cache.outputs.cache-hit != 'true'
81+
if: steps.check_node_modules_artifact.outputs.artifact_exists == 'false'
6882
uses: actions/upload-artifact@v4
6983
with:
70-
name: ${{ runner.os }}-modern-node-modules-${{ hashFiles('**/package-lock.json') }}
84+
name: modern-node-modules-${{ hashFiles('**/package-lock.json') }}
7185
path: node_modules
7286

7387
- name: Build package
@@ -247,7 +261,7 @@ jobs:
247261
- name: Download node_modules from artifacts
248262
uses: actions/download-artifact@v4
249263
with:
250-
name: ${{ runner.os }}-modern-node-modules-${{ hashFiles('**/package-lock.json') }}
264+
name: modern-node-modules-${{ hashFiles('**/package-lock.json') }}
251265
path: node_modules
252266

253267
- name: Download build output from artifacts

0 commit comments

Comments
 (0)