Skip to content

Commit 49fd15f

Browse files
committed
ci(action_tests): install terraform-docs, unskip its action test
The terraform-docs action's pre-commit hook shells out to the `terraform-docs` binary. Without it on PATH inside the test sandbox, the action exits with "terraform-docs not found" and the assertion on the README-staging error never fires. Mirrors the existing pattern for uv: install the binary in the Action Tests composite step (ubuntu-latest only, which matches the job's runs-on). With the binary available, the test can drop its skipTestIf guard and actually exercise the monorepo-aware behavior.
1 parent 6676e88 commit 49fd15f

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

.github/actions/action_tests/action.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ runs:
3636
with:
3737
version: 0.7.8
3838

39+
# The terraform-docs action's pre-commit hook shells out to
40+
# `terraform-docs`, so the binary needs to be on PATH inside the action
41+
# sandbox. There is no maintained setup-terraform-docs action, so install
42+
# the release tarball directly. Action Tests only run on ubuntu-latest.
43+
- name: Setup terraform-docs
44+
run: |
45+
version=0.16.0
46+
tmp=$(mktemp -d)
47+
curl -sSLo "$tmp/terraform-docs.tgz" \
48+
"https://github.com/terraform-docs/terraform-docs/releases/download/v${version}/terraform-docs-v${version}-linux-amd64.tar.gz"
49+
tar -xzf "$tmp/terraform-docs.tgz" -C "$tmp"
50+
sudo install -m 0755 "$tmp/terraform-docs" /usr/local/bin/terraform-docs
51+
terraform-docs --version
52+
shell: bash
53+
3954
- name: Specify defaults
4055
run: |
4156
echo "CLI_PATH=${{ inputs.cli-path }}" >> "$GITHUB_ENV"

actions/terraform-docs/terraform_docs.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,9 @@ const testCallback = async (driver: TrunkActionDriver) => {
4444
expect(commitError?.message).toContain("Please stage any README changes before committing.");
4545
};
4646

47-
// NOTE: Skipped by default. Running this test requires `terraform-docs` on
48-
// PATH inside the action sandbox; the action's plugin.yaml does not declare a
49-
// tool dependency, so CI would need a setup step (similar to the uv setup in
50-
// .github/actions/action_tests/action.yaml) to install terraform-docs before
51-
// the jest run. Drop `skipTestIf` once that is in place.
5247
actionRunTest({
5348
actionName: "terraform-docs",
5449
syncGitHooks: true,
5550
preCheck,
5651
testCallback,
57-
skipTestIf: () => true,
5852
});

0 commit comments

Comments
 (0)