Update Packages DX #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Packages DX | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # This will run the action every Sunday at midnight | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
update-packages: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Check for outdated packages @new-objects/* | |
run: | | |
npx npm-check-updates "/@new-objects/" -u | |
npm install | |
- name: Commit changes | |
run: | | |
git config user.name "GitHub Action" | |
git config user.email "[email protected]" | |
git add package.json package-lock.json | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
exit 0 | |
else | |
git commit -m "Update outdated packages" | |
fi | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
title: "Update outdated packages" | |
body: "This PR updates outdated packages of @new-objects/*." |