How do you test a custom action before releasing it?
IntermediateConceptCustom Actions & Reusable Workflows
Answer
Unit-test the logic (Jest or node --test, mocking @actions/core inputs via INPUT_* env vars), then an integration workflow in the action's repo that uses the action locally:
- uses: actions/checkout@v4
- id: self
uses: ./
with:
path: test/fixtures
- run: test "${{ steps.self.outputs.result }}" = "ok"
Run it on a matrix of ubuntu, windows, macos if it claims cross-platform support. nektos/act helps for fast local iteration but is not a full replacement for real runners.
More on Custom Actions & Reusable Workflows
What are the three kinds of custom action and how do you choose?BeginnerWrite a minimal composite action that installs Node and dependencies with caching.IntermediateWhat can a composite action not do compared to a job?IntermediateHow do you pass outputs out of a composite action?IntermediateWhat does `action.yml` contain for a JavaScript action?IntermediateWhy must a JavaScript action commit its `dist/` or `node_modules`?Intermediate