gitlab-npm-audit-fix
v1.0.1
Published
This GitLab CI CLI runs npm audit fix and creates a merge request
Maintainers
Readme
gitlab-npm-audit-fix
This GitLab CI CLI runs npm audit fix and creates or updates a merge request.
GitLab-oriented TypeScript port of the GitHub Action ybiquitous/npm-audit-fix-action.
It keeps the same high-level flow:
- run
npm ci - collect
npm audit --json - run
npm audit fix - run
npm ciagain - aggregate package changes
- commit + force-push a branch
- create or update a merge request
GitHub-specific behavior is adapted to GitLab using @gitbeaker/rest.
Usage
gitlab-npm-audit-fix --gitlab-token "${GITLAB_TOKEN}"Inputs (action-compatible, GitLab-adapted)
--gitlab-tokenGitLab token (default:GITLAB_TOKENorCI_JOB_TOKEN)--gitlab-userGit user name for commit changes--gitlab-emailGit user email for commit changes--branchcreated branch (default:gitlab-npm-audit-fix)--default-branchdefault branch (auto-detected when omitted)--commit-titlecommit message and merge request title--labelslabels for merge request (comma-separated)--assigneesassignees for merge request (comma-separated usernames)--npm-argsextra arguments for npm commands--pathpath to the project root directory--merge-request-template-filepath to merge request template file (optional, default: none)--merge-request-template-placeholderplaceholder token for report injection (default:<!-- gitlab-npm-audit-fix:report -->)
Behavior:
- Adds a severity label automatically based on the highest fixed vulnerability severity (
severity::critical,severity::high,severity::moderate,severity::low, orseverity::info). - If the template file is missing, the tool falls back to the generated merge request body.
GitLab CI example
npm_audit_fix:
image: node:24
before_script:
- cd webui
script:
- npx gitlab-npm-audit-fix --gitlab-token "${GITLAB_TOKEN}"