github workflows: add working-directory input parameter
Add optional working-directory input parameter to both go_test.yml and
webui_test.yml workflows with default value of '.', allowing workflows
to be run from different subdirectories when needed.
Changes made:
- go_test.yml: Added working-directory input, updated go.mod path reference,
added working-directory to Go generate and test steps
- webui_test.yml: Added working-directory input, updated package-lock.json path,
updated all webui-related step working directories and artifact path
Both workflows maintain backward compatibility with default '.' value while
enabling flexible directory targeting for workflow reuse.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: sbece0e025c355895k
diff --git a/.github/workflows/webui_test.yml b/.github/workflows/webui_test.yml
index 6a12c9a..490f162 100644
--- a/.github/workflows/webui_test.yml
+++ b/.github/workflows/webui_test.yml
@@ -7,6 +7,11 @@
required: false
type: string
default: ""
+ working-directory:
+ description: "Working directory for the workflow"
+ required: false
+ type: string
+ default: "."
push:
branches-ignore:
- "queue-main-*"
@@ -30,21 +35,24 @@
with:
node-version: "20"
cache: "npm"
- cache-dependency-path: webui/package-lock.json
+ cache-dependency-path: ${{ inputs.working-directory || '.'}}/webui/package-lock.json
- name: Optimize APT
- run: ./.github/scripts/optimize-apt.sh
+ working-directory: ${{ inputs.working-directory || '.'}}
+ run: |
+ pwd
+ ./.github/scripts/optimize-apt.sh
- name: Install dependencies
- working-directory: ./webui
+ working-directory: ${{ inputs.working-directory || '.'}}/webui
run: npm ci
- name: Install Playwright Chromium
- working-directory: ./webui
+ working-directory: ${{ inputs.working-directory || '.'}}/webui
run: npx playwright install chromium --with-deps
- name: Run tests
- working-directory: ./webui
+ working-directory: ${{ inputs.working-directory || '.'}}/webui
run: npm run test
- name: Upload test results
@@ -52,5 +60,5 @@
uses: actions/upload-artifact@v4
with:
name: playwright-report
- path: webui/playwright-report/
+ path: ${{ inputs.working-directory || '.'}}/webui/playwright-report/
retention-days: 7