Skip to content

feat: add working_directory input - #49

Merged
oycyc merged 1 commit into
mainfrom
feat/working-directory
Sep 21, 2026
Merged

oycyc merged 1 commit into
mainfrom
feat/working-directory

Conversation

@gberenice

Copy link
Copy Markdown
Member

What

The action always ran init and test from the repository root, which only suits repos holding a single module. Add a working_directory input so monorepos can point each matrix leg at the module under test.

- name: Run TF Test
  shell: bash
  working-directory: ${{ inputs.working_directory }}
  run: |
    ${{ inputs.tf_type }} init
    ${{ inputs.tf_type }} test

Backwards compatibility

The input defaults to ., so every existing caller behaves exactly as before.

Aqua still resolves aqua.yaml from the repository root rather than from working_directory, which keeps pinned CLI versions consistent across all modules in a monorepo.

Why now

This unblocks masterpointio/actions#4, which adds monorepo test discovery to the shared tf-test reusable workflow. That PR already passes working_directory but carries a TODO on its action pin, because the input doesn't exist in any release yet. Once this merges and is released, that pin gets bumped to the new SHA.

Testing

actionlint, zizmor --persona=pedantic, yamllint, prettier, and markdownlint all pass via trunk.

Made with Cursor

@gberenice
gberenice requested a review from a team as a code owner September 21, 2026 13:59
@gberenice
gberenice requested a review from Gowiem September 21, 2026 13:59
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: masterpointio/github-action-tf-test/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a04044a1-9139-4e10-a742-4c4cf81193ae


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gberenice
gberenice requested a review from oycyc September 21, 2026 14:01

@oycyc oycyc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 ✅ LGTM

@oycyc
oycyc merged commit 0350841 into main Sep 21, 2026
3 checks passed
@oycyc
oycyc deleted the feat/working-directory branch September 21, 2026 14:05
gberenice pushed a commit that referenced this pull request Sep 21, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.1.0](v1.0.1...v1.1.0)
(2026-09-21)


### Features

* add working_directory input
([#49](#49))
([0350841](0350841))


### Bug Fixes

* pin GitHub Actions to commit SHAs (INT-326)
([#33](#33))
([8dc20b2](8dc20b2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: masterpointbot[bot] <177651640+masterpointbot[bot]@users.noreply.github.com>
gberenice added a commit to masterpointio/actions that referenced this pull request Sep 21, 2026
## What

The `tf-test` reusable workflow assumed a single module at the
repository root, so monorepos had to hand-roll their own aqua + `init` +
`test` steps instead of consuming it.

- Add a `discover` job that finds every directory containing
`*.tftest.hcl` files and emits them as a JSON array. Both the `tests/`
subdirectory and module-root layouts collapse to the module directory.
- Fan the test job out across `(tf_type x module)` with `fail-fast:
false`, so callers stay zero-config as modules are added.
- Relax `aws_role_arn` and the `SPACELIFT_*` secrets to optional, since
they're consumer-specific and not every repo under test touches AWS or
Spacelift. Drop the redundant `required: false` lines and describe each
secret.
- Add job timeouts (5m discover, 30m test).
- Bump `masterpointio/github-action-tf-test` to v1.1.0, which adds the
`working_directory` input this depends on.

## Backwards compatibility

Root-level modules report as `.` and keep their original job name:

```yaml
name: 🧪 ${{ matrix.tf }} test${{ matrix.module != '.' && format(' ({0})', matrix.module) || '' }}
```

Without this, `terraform-spacelift-automation`'s checks would rename
from `🧪 tofu test` to `🧪 tofu test (.)` and break any branch protection
rules keyed to those names.

## Dependencies

masterpointio/github-action-tf-test#49 — merged
and released as
[v1.1.0](https://github.com/masterpointio/github-action-tf-test/releases/tag/v1.1.0),
now pinned here.

## Testing

Discovery pipeline verified against `infra-monorepo-template` (returns
`["child-modules/random-pet"]`) and against an empty repo (returns `[]`,
which skips the test job via the `if:` guard). `actionlint`, `zizmor
--persona=pedantic`, and `yamllint` all pass.

## Follow-up

`infra-monorepo-template` switches its hand-rolled `test.yaml` over to
this workflow once it's released.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants