Invental/Review lessons/Code that silently does the wrong thing

Code that silently does the wrong thing

CI directory defaults skip action steps

CI defaults are narrower than they look: GitHub Actions' defaults.run.working-directory covers shell steps only, so every uses: step in a sub-directory job needs the directory passed explicitly.

01 · Before and afterThe pattern

YAML
# before: looks scoped to the sub-project, but the action step runs at repo root
defaults: { run: { working-directory: ./service } }
steps:
  - uses: org/setup-toolchain@<sha>
  - run: make test            # this one is in ./service

# after: actions get the directory as an input
  - uses: org/setup-toolchain@<sha>
    with: { working_directory: ./service }

02 · Run it on your appThe check

In your CI, does every action step in a sub-directory job get the directory explicitly, or do you rely on a run default that it ignores?

If the honest answer is no or not sure, this is worth a look before it reaches production.

Want this checked on your code?

Tell us what you are building and what worries you. We match a senior reviewer to your code and confirm scope before anything starts.

— Get in touch
hi@invental.co ↗
— Or
— What to include

A link or short description of the code or system, what you want checked, your stack, and when you need the answer. No repository access is needed until scope is agreed.

— Or leave a note
We reply within one business day.