Skip to content

Commit

Permalink
feat: working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal authored Mar 28, 2024
1 parent 689c697 commit 400d019
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions better-dependabot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ inputs:
description: 'Comma-separated list of labels to apply to the pull request'
required: false
default: ''
working_directory:
description: 'Change the working directory for the action'
required: false
default: ''
runs:
using: 'composite'
steps:
Expand Down Expand Up @@ -70,26 +74,31 @@ runs:
run: npm install -g npm-check-updates

- name: Check npm updates
working-directory: ${{ inputs.working_directory }}
if: steps.check_pr.outputs.pr_exists == '0'
shell: bash
run: ncu --packageManager ${{ inputs.package_manager }} --target ${{ inputs.version_target }} ${{ inputs.ncu_args }}

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

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

- name: Audit fix
working-directory: ${{ inputs.working_directory }}
if: steps.check_pr.outputs.pr_exists == '0'
shell: bash
run: ${{ inputs.audit_command }}

- name: Check for Changes
working-directory: ${{ inputs.working_directory }}
if: steps.check_pr.outputs.pr_exists == '0'
id: check_changes
run: |
Expand All @@ -101,12 +110,14 @@ runs:
shell: bash

- name: Create a new branch
working-directory: ${{ inputs.working_directory }}
if: steps.check_pr.outputs.pr_exists == '0' && env.NO_CHANGES == 'false'
run: |
git checkout -b $BRANCH_NAME
shell: bash

- name: Commit changes
working-directory: ${{ inputs.working_directory }}
if: steps.check_pr.outputs.pr_exists == '0' && env.NO_CHANGES == 'false'
run: |
git config --global user.name 'github-actions[bot]'
Expand All @@ -119,6 +130,7 @@ runs:
GITHUB_TOKEN: ${{ inputs.token }}

- name: Create Pull Request
working-directory: ${{ inputs.working_directory }}
if: steps.check_pr.outputs.pr_exists == '0' && env.NO_CHANGES == 'false'
run: |
LABELS="${{ inputs.labels }}"
Expand Down

0 comments on commit 400d019

Please sign in to comment.