From b01e8e0980c6207a247d86c3aefb3b57c410d9e8 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 12 Nov 2026 10:19:45 +0000 Subject: [PATCH] .github: pass expressions to scripts through env Expressions expanded inside run and script bodies become code. --- .github/workflows/build.yml | 5 ++++- .github/workflows/integration-test-template.yml | 6 ++++-- .github/workflows/test-integration.yaml | 4 +++- .github/workflows/version-bump.yml | 12 ++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e393c4d1..989c3b3fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,6 +51,9 @@ jobs: - name: Vendor hash diverging uses: actions/github-script@v9.0.0 if: failure() && steps.vendorhash.outcome == 'failure' + env: + EXPECTED_SRI: ${{ steps.vendorhash.outputs.expected_sri }} + ACTUAL_SRI: ${{ steps.vendorhash.outputs.actual_sri }} with: github-token: ${{secrets.GITHUB_TOKEN}} script: | @@ -58,7 +61,7 @@ jobs: pull_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: 'Vendor hash in `flakehashes.json` is stale (was `${{ steps.vendorhash.outputs.expected_sri }}`, should be `${{ steps.vendorhash.outputs.actual_sri }}`). Run `go run ./cmd/vendorhash update` and commit the result.' + body: `Vendor hash in \`flakehashes.json\` is stale (was \`${process.env.EXPECTED_SRI}\`, should be \`${process.env.ACTUAL_SRI}\`). Run \`go run ./cmd/vendorhash update\` and commit the result.` }) - name: Run nix build diff --git a/.github/workflows/integration-test-template.yml b/.github/workflows/integration-test-template.yml index 4135bc6bf..990fc3b5c 100644 --- a/.github/workflows/integration-test-template.yml +++ b/.github/workflows/integration-test-template.yml @@ -115,12 +115,14 @@ jobs: # which works but is one step further from the source). DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_CI_USERNAME }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_CI_TOKEN }} + POSTGRES_FLAG: ${{ inputs.postgres_flag }} + TEST_NAME: ${{ inputs.test }} run: | /tmp/artifacts/hi run --stats --ts-memory-limit=300 --hs-memory-limit=1500 \ --test-binary=/tmp/artifacts/integration.test \ --timeout=120m \ - ${{ inputs.postgres_flag }} \ - "^${{ inputs.test }}$" + ${POSTGRES_FLAG} \ + "^${TEST_NAME}$" # Sanitize test name for artifact upload (replace invalid characters: " : < > | * ? \ / with -) - name: Sanitize test name for artifacts if: always() diff --git a/.github/workflows/test-integration.yaml b/.github/workflows/test-integration.yaml index 19af788ba..01c287d15 100644 --- a/.github/workflows/test-integration.yaml +++ b/.github/workflows/test-integration.yaml @@ -180,6 +180,8 @@ jobs: echo "versions=${versions}" >> "$GITHUB_OUTPUT" echo "Pre-pulling: ${versions}" - name: Pull Tailscale images + env: + VERSIONS: ${{ steps.versions.outputs.versions }} run: | # Releases come from ghcr.io (anonymous, unmetered). The # "unstable" floating tag on ghcr.io has been stale since 2022, @@ -187,7 +189,7 @@ jobs: # out one process per tag and returns non-zero if any pull # fails. refs="" - for v in ${{ steps.versions.outputs.versions }}; do + for v in ${VERSIONS}; do if [ "${v}" = "unstable" ]; then refs="${refs} tailscale/tailscale:${v}" else diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index fc00b911b..f1f67d4e1 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -81,15 +81,19 @@ jobs: id: bump env: GH_TOKEN: ${{ github.token }} + GATE: ${{ inputs.gate || 'full' }} + AREAS: ${{ inputs.areas }} + DRY_RUN: ${{ inputs.dry-run || false }} + FORCE: ${{ inputs.force || false }} run: | # Built before the run moves HEAD, so Publish does not compile the # freshly bumped dependencies. go build -o "$RUNNER_TEMP/bump" ./tools/bump "$RUNNER_TEMP/bump" run \ - --gate="${{ inputs.gate || 'full' }}" \ - --areas="${{ inputs.areas }}" \ - --dry-run="${{ inputs.dry-run || false }}" \ - --force="${{ inputs.force || false }}" \ + --gate="$GATE" \ + --areas="$AREAS" \ + --dry-run="$DRY_RUN" \ + --force="$FORCE" \ --handoff="$RUNNER_TEMP/bump.json" if [ -f "$RUNNER_TEMP/bump.json" ]; then echo "handoff=true" >> "$GITHUB_OUTPUT"