Skip to content

Commit

Permalink
feat: new options
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal authored Mar 28, 2024
1 parent 8c50659 commit cfc04bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions better-dependabot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The Better Dependabot GitHub Action automates the process of updating NPM packag
| `token` | A GitHub PAT (Personal Access Token) for authenticating GitHub CLI operations. | Yes | N/A |
| `target_branch` | The target branch for the PR | No | `main` |
| `context` | It is used inside the branch name. E.g: You can use it to differentiate multiple PRs in a monorepo | No | `default` |
| `audit_command` | Audit command to use | No | `npm audit --package-lock-only` fix |
| `package_manager` | package manager to use | No | `npm` |


## Usage
Expand Down
16 changes: 12 additions & 4 deletions better-dependabot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ inputs:
description: 'The PR target branch'
default: 'main'
required: false
audit_command:
description: 'Audit command to use. Default: npm audit --package-lock-only fix'
default: 'npm audit --package-lock-only fix'
required: false
package_manager:
description: 'Package manager to use. Default: npm'
default: 'npm'
required: false
runs:
using: 'composite'
steps:
Expand Down Expand Up @@ -60,22 +68,22 @@ runs:
- name: Check npm updates
if: steps.check_pr.outputs.pr_exists == '0'
shell: bash
run: ncu --target ${{ inputs.version_target }} ${{ inputs.ncu_args }}
run: ncu --packageManager ${{ inputs.package_manager }} --target ${{ inputs.version_target }} ${{ inputs.ncu_args }}

- name: Update package.json
if: steps.check_pr.outputs.pr_exists == '0'
shell: bash
run: ncu -u --target ${{ inputs.version_target }} ${{ inputs.ncu_args }}
run: ncu -u --packageManager ${{ inputs.package_manager }} --target ${{ inputs.version_target }} ${{ inputs.ncu_args }}

- name: Install updated packages
if: steps.check_pr.outputs.pr_exists == '0'
shell: bash
run: npm install --package-lock-only
run: ${{ inputs.package_manager }} install --package-lock-only

- name: Audit fix
if: steps.check_pr.outputs.pr_exists == '0'
shell: bash
run: npm audit --package-lock-only fix
run: ${{ inputs.audit_command }}

- name: Check for Changes
if: steps.check_pr.outputs.pr_exists == '0'
Expand Down

0 comments on commit cfc04bf

Please sign in to comment.