Skip to content

update-dependencies #14

update-dependencies

update-dependencies #14

name: update-dependencies
on:
schedule:
- cron: "47 4 * * *"
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup nodejs version
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm ci
- name: Apply updates
run: npm run update
- name: Check for modified files
id: gitCheck
run: |
echo "diff=$(git diff -U0 package.json | grep -e '^+ ' | awk '{ print $2 }' | sed 's/[\":]//g' | xargs | sed -e 's/ / + /g')" >>$GITHUB_OUTPUT
if [ -n "$(git status --porcelain)" ]; then
echo "modified=true" >> $GITHUB_OUTPUT
else
echo "modified=false" >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
- name: Create Pull Request
id: createPR
if: steps.gitCheck.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v5
with:
branch: update-dependencies
author: Dependency Updater <[email protected]>
commit-message: "chore: update dependencies for ${{steps.gitCheck.outputs.diff}}"
title: Update dependencies
body: |
- Dependency updates
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
delete-branch: true
labels: automated pr
- name: Enable auth-merge
if: steps.gitCheck.outputs.modified == 'true'
uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ steps.createPR.outputs.pull-request-number }}
merge-method: rebase