Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP2universalStack: GitHub Actions
cinpmconfigurationdry
Set the npm auth token env var once for the whole workflow instead of per step
npm reads NPM_AUTH_TOKEN from the environment, so define it once at workflow/top level rather than amending .npmrc before every install.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codeyaml
| 1 | - run: echo "//npm.pkg.github.com/:_authToken=${TOKEN}" >> .npmrc |
| 2 | # repeated before every install step |
Explanation (EN)
Objašnjenje (HR)
Good example
New codeyaml
| 1 | env: |
| 2 | NPM_AUTH_TOKEN: ${{ secrets.HEGNAR_GITHUB_TOKEN }} |
| 3 | # .npmrc: //npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN} |
Explanation (EN)
Objašnjenje (HR)