Skip to content

ci: refactor deps bot #9

ci: refactor deps bot

ci: refactor deps bot #9

Workflow file for this run

# Groups minor and patch dependency updates into a single PR.
name: '⏫ Bot — Dependencies'
on:
schedule:
- cron: '0 3 * * *'
pull_request:
workflow_dispatch:
env:
PR_TITLE: 'chore: update dependencies'
jobs:
update-deps:
runs-on: ubuntu-latest
name: Update
steps:
- name: ➕ Actions - Checkout
uses: actions/checkout@v4
- name: ➕ Actions - Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: ➕ Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-linux-${{ hashFiles('package-lock.json') }}
restore-keys: npm-linux-
- name: 📦 Installing Dependencies
run: npm ci
- name: ⏫ Updating Dependencies
run: npm run update
- name: ⚙️ Configuring Git
run: |
git config --global user.name 'wellwelwel'
git config --global user.email '[email protected]'
git update-index --refresh > /dev/null 2>&1 || true
- name: 🔎 Checking for Changes
id: check_changes
run: |
if git diff-index --quiet HEAD --; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: 🤖 Checking open PRs
if: steps.check_changes.outputs.changes == 'true'
id: check_pr
run: |
echo "pr_exists=false" >> $GITHUB_OUTPUT
if npx tsx tools/workflows/get-prs.ts --title="${{ env.PR_TITLE }}"; then
echo "pr_exists=true" >> $GITHUB_OUTPUT
fi
echo pr_exists
- name: 🚀 Commiting and Pushing Changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git add .
git commit -m "${{ env.PR_TITLE }}"
git push origin HEAD:refs/heads/deps --force
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: 🧙🏻 Debug
run: |
echo ${{ steps.check_changes.outputs.changes }}
echo ${{ steps.set_pr_exists.outputs.pr_exists }}
# - name: 🧙🏻 Creating Pull Request
# if: steps.check_changes.outputs.changes == 'true' && steps.set_pr_exists.outputs.pr_exists == 'false'
# uses: peter-evans/create-pull-request@v6
# with:
# token: ${{ secrets.PAT }}
# branch: deps
# delete-branch: true
# title: '${{ env.PR_TITLE }}'
# body: '- 🤖 Update project dependencies'
# labels: |
# dependencies