Skip to content

Commit

Permalink
check for changes before
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal authored Mar 28, 2024
1 parent e2b20f6 commit 3ba4039
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions better-dependabot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,25 @@ runs:
shell: bash
run: npm install --package-lock-only

- name: Create a new branch
- name: Check for Changes
if: steps.check_pr.outputs.pr_exists == '0'
id: check_changes
run: |
if git diff --quiet && git diff --staged --quiet; then
echo "NO_CHANGES=true" >> $GITHUB_ENV
else
echo "NO_CHANGES=false" >> $GITHUB_ENV
fi
shell: bash

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

# Placeholder for committing changes - customize as necessary
- name: Commit changes
if: steps.check_pr.outputs.pr_exists == '0'
if: steps.check_pr.outputs.pr_exists == '0' && env.NO_CHANGES == 'false'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
Expand All @@ -89,7 +99,7 @@ runs:
GITHUB_TOKEN: ${{ inputs.token }}

- name: Create Pull Request
if: steps.check_pr.outputs.pr_exists == '0'
if: steps.check_pr.outputs.pr_exists == '0' && env.NO_CHANGES == 'false'
run: |
gh pr create --title "Better Dependabot: Update ${{ inputs.version_target }} dependencies" --body "This PR updates dependencies to the most recent ${{ inputs.version_target }} versions." --head $BRANCH_NAME --base ${{ inputs.target_branch }}
shell: bash
Expand Down

0 comments on commit 3ba4039

Please sign in to comment.