Skip to content

Commit e9692d4

Browse files
committed
chore: get the workspace output from the composite action
1 parent 23f82ef commit e9692d4

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.github/actions/npm-setup/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ inputs:
1212
description: 'Key for the cache'
1313
required: true
1414

15+
outputs:
16+
workspace_path:
17+
description: "Full path to the workspace directory"
18+
value: ${{ steps.set-env.outputs.workspace_path }}
19+
1520
runs:
1621
using: "composite"
1722
steps:
@@ -30,6 +35,7 @@ runs:
3035
echo "EOF" >> $GITHUB_ENV
3136
echo "HASH_PATHS=package-lock.json,packages/testcontainers/package-lock.json" >> $GITHUB_ENV
3237
echo "WORKSPACE_PATH=packages/testcontainers" >> $GITHUB_ENV
38+
echo "workspace_path=packages/testcontainers" >> $GITHUB_OUTPUT
3339
else
3440
echo "CACHE_PATHS<<EOF" >> $GITHUB_ENV
3541
echo "node_modules" >> $GITHUB_ENV
@@ -38,6 +44,7 @@ runs:
3844
echo "EOF" >> $GITHUB_ENV
3945
echo "HASH_PATHS=package-lock.json,packages/testcontainers/package-lock.json,packages/modules/${{ inputs.workspace }}/package-lock.json" >> $GITHUB_ENV
4046
echo "WORKSPACE_PATH=packages/modules/${{ inputs.workspace }}" >> $GITHUB_ENV
47+
echo "workspace_path=packages/modules/${{ inputs.workspace }}" >> $GITHUB_OUTPUT
4148
fi
4249
4350
- uses: actions/cache/restore@v4

.github/workflows/test-template.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,12 @@ jobs:
131131
uses: actions/checkout@v4
132132

133133
- name: Install Node ${{ inputs.node-version }} and Dependencies
134+
id: npm-install
134135
uses: ./.github/actions/npm-setup
135136
with:
136137
runner: ${{ inputs.runner }}
137138
node-version: ${{ inputs.node-version }}
138139
workspace: "${{ inputs.workspace }}"
139140

140141
- name: Run tests
141-
run: npm run test:ci -- ${{ inputs.workspace }}
142+
run: npm run test:ci -- ${{ steps.npm-install.outputs.workspace_path }}

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@ jobs:
6161
- name: Code checkout
6262
uses: actions/checkout@v4
6363
- name: Install Node and Dependencies
64+
id: npm-install
6465
uses: ./.github/actions/npm-setup
6566
with:
6667
runner: ubuntu-22.04
6768
node-version: 22.x
6869
workspace: "${{ matrix.module }}"
6970
- name: Code linting
70-
run: npm run lint:ci -- ${{ matrix.module }}
71+
run: npm run lint:ci -- ${{ steps.npm-install.outputs.workspace_path }}
7172

7273
smoke-test:
7374
# only run if there are modules to lint

0 commit comments

Comments
 (0)