Skip to content

Add GitHub Actions workflow to auto-fix Dependabot lockfile#149

Merged
amine7536 merged 1 commit intomainfrom
claude/fix-npm-lock-sync-2CT5o
Feb 16, 2026
Merged

Add GitHub Actions workflow to auto-fix Dependabot lockfile#149
amine7536 merged 1 commit intomainfrom
claude/fix-npm-lock-sync-2CT5o

Conversation

@amine7536
Copy link
Contributor

Summary

This PR adds a new GitHub Actions workflow that automatically regenerates and commits the package-lock.json file when Dependabot creates pull requests. This ensures the lockfile stays in sync with package.json changes.

Key Changes

  • Added .github/workflows/dependabot-fix-lockfile.yml workflow that:
    • Triggers on pull requests to main and next branches
    • Only runs when the PR author is dependabot[bot]
    • Checks out the PR branch with write permissions
    • Sets up Node.js 22
    • Regenerates the lockfile using npm install --package-lock-only --ignore-scripts
    • Commits and pushes the updated lockfile if changes are detected
    • Uses hardened runner for security auditing

Implementation Details

  • The workflow uses a conditional check to only run on Dependabot PRs, preventing unnecessary executions
  • It includes a safety check to only commit if the lockfile actually changed
  • Uses GitHub Actions bot credentials for commits to maintain proper attribution
  • Includes security hardening via step-security/harden-runner with audit-level egress policy

https://claude.ai/code/session_01W2qSm36L1wLHWQZyqn8ywy

Dependabot regenerates package-lock.json when bumping dependencies but
drops optional peer dependencies (react-devtools-core, ws) from the
lockfile. This causes `npm ci` to fail with EUSAGE errors.

Add a workflow that runs `npm install --package-lock-only` on dependabot
PRs to regenerate the lockfile correctly and commits the fix.

https://claude.ai/code/session_01W2qSm36L1wLHWQZyqn8ywy
@amine7536 amine7536 merged commit cb55417 into main Feb 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants