refactor: remove custom getInput/getBooleanInput wrappers#66
Conversation
Replace with direct core.getInput() calls. The custom wrappers added a redundant env var fallback (dash-to-underscore conversion) that core.getInput() effectively handles on its own. Update local dev header comments to reflect how core.getInput() reads INPUT_<NAME> env vars with hyphens preserved.
|
@copilot I see we lowered our code coverage a bit, unsure if there are obvious candidate tests to add w/o being explicitly verbose or inane. |
There was a problem hiding this comment.
Pull request overview
Refactors the action to remove custom input wrapper helpers and rely directly on @actions/core input APIs, simplifying input handling and updating local-development guidance accordingly.
Changes:
- Removed custom
getInput()/getBooleanInput()helpers and switched callers tocore.getInput(). - Updated local-development comment block to document hyphenated
INPUT_*env var behavior. - Bumped package version and refreshed the coverage badge.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/index.js |
Removes input wrapper helpers, switches to core.getInput(), and updates local-dev instructions. |
package.json |
Bumps package version to 2.0.1. |
badges/coverage.svg |
Updates the displayed coverage percentage. |
Agent-Logs-Url: https://github.com/joshjohanning/nodejs-actions-starter-template/sessions/c0318f92-885e-44e5-91ae-23687d2d0fd2 Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
…ests Agent-Logs-Url: https://github.com/joshjohanning/nodejs-actions-starter-template/sessions/c0318f92-885e-44e5-91ae-23687d2d0fd2 Co-authored-by: joshjohanning <19912012+joshjohanning@users.noreply.github.com>
Added two meaningful tests in commit
Also fixed a pre-existing mock leak while I was at it: the "should handle errors gracefully" test was using Coverage improved from 72.91% → 97.91% statements and 48% → 80% branches. The only uncovered line remaining is the |
Addresses Copilot review feedback — the previous === 'true' check was case-sensitive and would silently treat True/TRUE as false. core.getBooleanInput handles case variations per the Actions API.
Prevents mock return value from persisting across tests since jest.clearAllMocks does not reset mock implementations.
- Use mockReturnValueOnce/mockResolvedValueOnce/mockRejectedValueOnce to prevent mock state leaking across tests - Remove 'inline assignment' wording from local dev docs for consistency with other repos
- Update README to use env(1) with hyphenated INPUT_* names, consistent with header comment and other repos - Set getBooleanInput default to false in beforeEach for realistic mock behavior
📦 Draft Release CreatedA draft release v2.0.1 has been created for this PR. Next Steps
|
Remove the custom
getInput()andgetBooleanInput()wrapper functions and replace with directcore.getInput()andcore.getBooleanInput()calls.Why
The custom wrappers added a fallback that converted dashes to underscores in env var names (
INPUT_WHO_TO_GREETinstead ofINPUT_WHO-TO-GREET). This was meant to help with local development since shells can't export vars with hyphens, butcore.getInput()already readsINPUT_*env vars on its own - the wrapper was redundant.Changes
getInput()andgetBooleanInput()functions fromsrc/index.jsgetInput()calls withcore.getInput()getBooleanInput()calls withcore.getBooleanInput()for proper case-insensitive boolean handling per YAML 1.2 Core Schemacore.getInput()works with env vars