diff --git a/.github/workflows/ci-markdown.yml b/.github/workflows/ci-markdown.yml index eeada75..8c53601 100644 --- a/.github/workflows/ci-markdown.yml +++ b/.github/workflows/ci-markdown.yml @@ -28,10 +28,9 @@ jobs: echo "Applied org config: $CONFIG_FILE" fi - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - # renovate: datasource=node-version depName=node - node-version: "26" + # node comes from the calling repository's .mise.toml — the single + # source of truth for tool versions, kept fresh by Renovate. + - uses: h13/.github/actions/setup-toolchain@146f7b04b4bfbfd7bf935a30879f2ac18dfc4a57 # v1.2.0 - env: GLOB: ${{ inputs.glob }} diff --git a/.github/workflows/ci-node.yml b/.github/workflows/ci-node.yml index 84917a0..b1a02a5 100644 --- a/.github/workflows/ci-node.yml +++ b/.github/workflows/ci-node.yml @@ -16,23 +16,8 @@ jobs: # Toolchain comes from the calling repository's .mise.toml — the single # source of truth for node/pnpm versions, kept fresh by Renovate. - - uses: jdx/mise-action@3277a0f272901982804abc53abd93520db809be4 # v5.4.0 - with: - # renovate: datasource=github-releases depName=jdx/mise - version: "2026.11.16" - - - name: Resolve pnpm store path - id: pnpm-store - run: echo "path=$(pnpm store path)" >> "$GITHUB_OUTPUT" - - - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - pnpm-store-${{ runner.os }}- + - uses: h13/.github/actions/setup-toolchain@146f7b04b4bfbfd7bf935a30879f2ac18dfc4a57 # v1.2.0 - - run: pnpm install --frozen-lockfile --ignore-scripts || { echo "::error::Lockfile out of date. Run 'pnpm install' locally and commit pnpm-lock.yaml"; exit 1; } - run: pnpm run --if-present build - run: pnpm run --if-present lint - run: pnpm run --if-present typecheck diff --git a/.github/workflows/ci-opentofu.yml b/.github/workflows/ci-opentofu.yml index 364f18b..e782d96 100644 --- a/.github/workflows/ci-opentofu.yml +++ b/.github/workflows/ci-opentofu.yml @@ -2,11 +2,6 @@ name: CI (OpenTofu) on: workflow_call: - inputs: - opentofu-version: - description: OpenTofu version - type: string - default: "latest" permissions: contents: read @@ -19,9 +14,9 @@ jobs: with: persist-credentials: false - - uses: opentofu/setup-opentofu@a1320f892987e89d278cc92dc5adc984fb93aca4 # v2.0.2 - with: - tofu_version: ${{ inputs.opentofu-version }} + # opentofu comes from the calling repository's .mise.toml — the single + # source of truth for tool versions, kept fresh by Renovate. + - uses: h13/.github/actions/setup-toolchain@146f7b04b4bfbfd7bf935a30879f2ac18dfc4a57 # v1.2.0 - run: tofu fmt -check -recursive - run: tofu init -backend=false @@ -34,7 +29,8 @@ jobs: with: persist-credentials: false - - uses: terraform-linters/setup-tflint@6ffdbaa3be476b3431f7275c26966ef32ff60337 # v6.3.2 + # tflint comes from the calling repository's .mise.toml + - uses: h13/.github/actions/setup-toolchain@146f7b04b4bfbfd7bf935a30879f2ac18dfc4a57 # v1.2.0 - run: tflint --init - run: tflint --recursive diff --git a/.github/workflows/ci-terraform.yml b/.github/workflows/ci-terraform.yml index 422b0bb..af51d73 100644 --- a/.github/workflows/ci-terraform.yml +++ b/.github/workflows/ci-terraform.yml @@ -3,10 +3,6 @@ name: CI (Terraform) on: workflow_call: inputs: - terraform-version: - description: Terraform version - type: string - default: "latest" working-directory: description: Directory containing the Terraform configuration type: string @@ -26,9 +22,9 @@ jobs: with: persist-credentials: false - - uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1 - with: - terraform_version: ${{ inputs.terraform-version }} + # terraform comes from the calling repository's .mise.toml — the single + # source of truth for tool versions, kept fresh by Renovate. + - uses: h13/.github/actions/setup-toolchain@146f7b04b4bfbfd7bf935a30879f2ac18dfc4a57 # v1.2.0 - run: terraform fmt -check -recursive - run: terraform init -backend=false @@ -44,7 +40,8 @@ jobs: with: persist-credentials: false - - uses: terraform-linters/setup-tflint@6ffdbaa3be476b3431f7275c26966ef32ff60337 # v6.3.2 + # tflint comes from the calling repository's .mise.toml + - uses: h13/.github/actions/setup-toolchain@146f7b04b4bfbfd7bf935a30879f2ac18dfc4a57 # v1.2.0 - run: tflint --init - run: tflint --recursive diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c260c4..ad2ac81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: - "profile/**" - "sync/**" - ".markdownlint-cli2.yaml" + - ".mise.toml" pull_request: paths: - ".github/workflows/**" @@ -16,6 +17,7 @@ on: - "profile/**" - "sync/**" - ".markdownlint-cli2.yaml" + - ".mise.toml" permissions: contents: read diff --git a/.github/workflows/publish-node.yml b/.github/workflows/publish-node.yml index 88303c4..0b1fea5 100644 --- a/.github/workflows/publish-node.yml +++ b/.github/workflows/publish-node.yml @@ -15,15 +15,20 @@ jobs: with: persist-credentials: false - - uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1 - - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + # Toolchain comes from the calling repository's .mise.toml — the single + # source of truth for node/pnpm versions, kept fresh by Renovate. + # mise-action is used directly instead of the setup-toolchain action: + # this job publishes with elevated credentials, so it must not restore + # caches (cache poisoning of a release path). No registry-url/.npmrc + # setup is needed — publishing authenticates via OIDC trusted + # publishing (id-token: write). + - uses: jdx/mise-action@3277a0f272901982804abc53abd93520db809be4 # v5.4.0 with: - # renovate: datasource=node-version depName=node - node-version: "26" - registry-url: https://registry.npmjs.org + # renovate: datasource=github-releases depName=jdx/mise + version: "2026.11.16" + cache: "false" - - run: pnpm install --frozen-lockfile + - run: pnpm install --frozen-lockfile --ignore-scripts - run: pnpm run build - run: pnpm test - run: pnpm publish --no-git-checks --access public --provenance diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 0000000..0d4dad8 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,2 @@ +[tools] +node = "26.13.1" diff --git a/README.md b/README.md index 86b21e6..d1fc1c8 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,34 @@ Default community health files, reusable workflows, and shared config for h13 re Call from any repo via `uses: h13/.github/.github/workflows/@`: -| Workflow | Stack | Inputs | Steps | -| ------------------ | --------- | ------------------------------------------------------------------------------------- | ------------------------------------------- | -| `ci-node.yml` | Node.js | `node-version` | npm ci (cached) → npm run lint → npm test | -| `ci-go.yml` | Go | — | go test -race → golangci-lint | -| `ci-php.yml` | PHP | `php-version`, `php-extensions`, `working-directory`, `composer-args`, `test-command` | composer install (cached) → composer test | -| `ci-terraform.yml` | Terraform | `terraform-version` | terraform fmt/init/validate → tflint | -| `ci-markdown.yml` | Markdown | `glob` | markdownlint-cli2 (org config auto-applied) | +| Workflow | Stack | Inputs | Steps | +| ------------------ | -------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------- | +| `ci-node.yml` | Node.js (pnpm) | — | pnpm install (cached) → build/lint/typecheck/test | +| `publish-node.yml` | Node.js (pnpm) | — | build → test → pnpm publish (OIDC provenance) | +| `ci-go.yml` | Go | — | go test -race → golangci-lint | +| `ci-php.yml` | PHP | `php-version`, `php-extensions`, `working-directory`, `composer-args`, `test-command` | composer install (cached) → composer test | +| `ci-terraform.yml` | Terraform | `working-directory` | terraform fmt/init/validate → tflint | +| `ci-opentofu.yml` | OpenTofu | — | tofu fmt/init/validate → tflint | +| `ci-markdown.yml` | Markdown | `glob` | markdownlint-cli2 (org config auto-applied) | +| `ci-zizmor.yml` | GitHub Actions | `min-severity` | zizmor static analysis of workflows | All workflows enforce `permissions: { contents: read }` (least-privilege). +### Toolchain policy + +Runtimes and CLIs come from the **calling repository's `.mise.toml`** via the +`setup-toolchain` action — one source of truth shared by local dev and CI, +kept fresh by Renovate. The exceptions are deliberate: + +- **Go** (`ci-go.yml`): `actions/setup-go` reads the version from `go.mod` and + ships module/build caching that mise does not provide +- **PHP** (`ci-php.yml`): `shivammathur/setup-php` installs prebuilt binaries + and extensions; the mise PHP plugin compiles from source + +Repositories calling the mise-based workflows (`ci-node`, `publish-node`, +`ci-terraform`, `ci-opentofu`, `ci-markdown`) must declare the required tools +(`node`/`pnpm`, `terraform`/`tflint`, `opentofu`/`tflint`, …) in `.mise.toml`. + ### Example ```yaml