.github/workflows: thread formatted HEAD commit to test sub-actions
Thread the commit SHA from the formatting job to the test jobs in GitHub workflows.
This ensures that when auto-formatting runs in the queue-main and queue-dev workflows,
tests run against the newly formatted code rather than the original code.
Co-Authored-By: sketch <hello@sketch.dev>
diff --git a/.github/workflows/go_test.yml b/.github/workflows/go_test.yml
index b736432..a6fba4c 100644
--- a/.github/workflows/go_test.yml
+++ b/.github/workflows/go_test.yml
@@ -1,6 +1,12 @@
name: go_tests
on:
workflow_call:
+ inputs:
+ ref:
+ description: "The git ref to checkout"
+ required: false
+ type: string
+ default: ""
push:
branches-ignore:
- "queue-main-*"
@@ -10,7 +16,9 @@
test:
runs-on: "ubuntu-latest"
steps:
- - uses: actions/checkout@master
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.ref }}
- uses: actions/setup-go@v5
with:
diff --git a/.github/workflows/queue-dev.yml b/.github/workflows/queue-dev.yml
index a9a1b54..2b8a141 100644
--- a/.github/workflows/queue-dev.yml
+++ b/.github/workflows/queue-dev.yml
@@ -24,11 +24,15 @@
needs: [formatting]
uses: ./.github/workflows/go_test.yml
permissions: read-all
+ with:
+ ref: ${{ needs.formatting.outputs.commit_sha }}
ui-test:
needs: [formatting]
uses: ./.github/workflows/webui_test.yml
permissions: read-all
+ with:
+ ref: ${{ needs.formatting.outputs.commit_sha }}
push-to-main:
runs-on: ubuntu-latest
diff --git a/.github/workflows/queue-main.yml b/.github/workflows/queue-main.yml
index e66f15f..03410b0 100644
--- a/.github/workflows/queue-main.yml
+++ b/.github/workflows/queue-main.yml
@@ -29,11 +29,15 @@
needs: [formatting]
uses: ./.github/workflows/go_test.yml
permissions: read-all
+ with:
+ ref: ${{ needs.formatting.outputs.commit_sha }}
ui-test:
needs: [formatting]
uses: ./.github/workflows/webui_test.yml
permissions: read-all
+ with:
+ ref: ${{ needs.formatting.outputs.commit_sha }}
push-to-main:
runs-on: ubuntu-latest
diff --git a/.github/workflows/webui_test.yml b/.github/workflows/webui_test.yml
index 073877c..f1e0779 100644
--- a/.github/workflows/webui_test.yml
+++ b/.github/workflows/webui_test.yml
@@ -1,6 +1,12 @@
name: WebUI Tests
on:
workflow_call:
+ inputs:
+ ref:
+ description: "The git ref to checkout"
+ required: false
+ type: string
+ default: ""
push:
branches-ignore:
- "queue-main-*"
@@ -16,6 +22,8 @@
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4