Disable Husky consistently across all CI workflows #16
+9
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Husky's
preparescript executes during npm lifecycle events beyond justnpm ci. SettingHUSKY=0only at the install step leaves subsequentnpm run build,npm test, andnpm publishcommands vulnerable to hook execution in CI.Changes
HUSKY: 0from step-level to job-levelenvblockBefore:
After:
This prevents Git hooks from executing during any npm operation across build, test, release, and publish workflows.
Original prompt
puoi implementare questo: The HUSKY: 0 environment variable is set only for the install step, but husky's prepare script (defined in package.json line 24) may still run during the build or publish steps. This could cause issues if git hooks try to execute in the CI environment.
Consider setting the HUSKY: 0 environment variable at the job level or for all steps that might trigger npm scripts, to ensure husky is consistently disabled throughout the CI workflow.ù
TITLE:
Enable publish via manual dispatch + ensure HUSKY is disabled consistently in CI
USER INTENT:
Make the repository's release workflow publish package to npm both on tag push and on manual workflow dispatch (when a non-empty
taginput is provided), and ensure Husky Git hooks are consistently disabled across CI steps to avoid running hooks during build/publish.TASK DESCRIPTION:
publishjob runs:taginput is supplied.npm cistep to a broader scope (job-level or workflow-level), so Husky'spreparescript does not run later during build/publish steps.NPM_TOKEN) and that the publish step will run only when intended.EXISTING:
NPM_TOKEN).tag.publishjobifcondition to:if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '')
.github/workflows/release.yml(after edit) contains:build_and_releasejob that builds, zips types, creates a GitHub Release and uploadsdist/*assets.publishjob that depends onbuild_and_releaseand runs npm publish usingNODE_AUTH_TOKENfromsecrets.NPM_TOKEN.publishjob: theInstall dependencies (disable husky in CI)step sets HUSKY=0 only for that npm install step, not at the job level.PENDING:
envfor jobs that run npm scripts (at leastbuild_and_releaseandpublish) so Husky'spreparescript cannot run during later build/publish steps.setup-nodeparameters to avoid linter warnings (e.g., use documented keys likenode-versionrather thannode-version-file) — currently static analyzer raised warnings, though they are not necessarily blocking for GitHub Actions runtime.taginput to confirm publish job triggers.CODE STATE:
Files discussed/modified:
Important snippets from the current file (post-edit, showing the key areas):
build_and_releasejob (high level)publishjob (current condition + HUSKY only on install step)