Skip to content

Instantly share code, notes, and snippets.

@z4nr34l
Created December 12, 2025 12:36
Show Gist options
  • Select an option

  • Save z4nr34l/84fd16229eb821ac2985402ef59dc53d to your computer and use it in GitHub Desktop.

Select an option

Save z4nr34l/84fd16229eb821ac2985402ef59dc53d to your computer and use it in GitHub Desktop.
Just put this file in your next.js repository inside .github/workflows/ and get PRs with latest version of Next every 8h (if there was newer)
name: Update Dependencies
on:
schedule:
# Runs every 8 hours (at 00:00, 08:00, and 16:00 UTC)
- cron: "0 */8 * * *"
workflow_dispatch: # Allows manual trigger
permissions:
contents: write
pull-requests: write
jobs:
update-dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Next.js upgrade codemod
run: npx @next/codemod@canary upgrade latest
- name: Check for changes
id: check_changes
run: |
git diff --quiet pnpm-lock.yaml package.json apps/marketing/package.json packages/ui/package.json packages/typescript-config/package.json || echo "has_changes=true" >> $GITHUB_OUTPUT
- name: Install updated dependencies
if: steps.check_changes.outputs.has_changes == 'true'
run: pnpm install
- name: Run checks
if: steps.check_changes.outputs.has_changes == 'true'
run: |
pnpm dlx ultracite fix
pnpm check
- name: Create Pull Request
if: steps.check_changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update dependencies to latest versions"
branch: chore/update-dependencies
delete-branch: true
title: "chore: update dependencies to latest versions"
body: |
## 📦 Dependency Updates
This PR updates dependencies to their latest versions using `@next/codemod upgrade latest`.
### ✅ Checks Performed
- TypeScript compilation
- Linting with Ultracite/Biome
- Code formatting
---
*This PR was automatically generated by the Update Dependencies workflow.*
labels: |
dependencies
automated
assignees: ${{ github.repository_owner }}
- name: No updates found
if: steps.check_changes.outputs.has_changes != 'true'
run: echo "✅ All dependencies are up to date!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment