.github: pass expressions to scripts through env

Expressions expanded inside run and script bodies become code.
This commit is contained in:
Kristoffer Dalby committed 2026-11-20 19:47:15 +01:00
1 parent 51fd8dd1b6
commit b01e8e0980
4 files changed
+19 -8

No files matched your search

+4 -1
View File
@@ -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
@@ -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()
+3 -1
View File
@@ -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
+8 -4
View File
@@ -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"