Skip to content

Instantly share code, notes, and snippets.

@wilsenhc
Created January 29, 2025 19:12
Show Gist options
  • Save wilsenhc/9fa8a764e28205576c6bb18b368105e1 to your computer and use it in GitHub Desktop.
Save wilsenhc/9fa8a764e28205576c6bb18b368105e1 to your computer and use it in GitHub Desktop.
Composer auto-update
name: Automatic composer upgrade
on:
schedule:
- cron: '0 12 1 * *'
jobs:
types:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.3' ]
branch: [ 'staging', 'develop' ]
exclude:
- php: 8.3
branch: staging
- php: 7.4
branch: develop
name: Automatic composer upgrade ${{ matrix.branch }} / php-${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- name: Update dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction
- name: Run Laravel Pint if available in the specific branch
run: if [ -f ./vendor/bin/pint ]; then ./vendor/bin/pint --no-interaction > /dev/null; fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: "[chore][${{ matrix.branch }}][php${{ matrix.php }}] Automatic composer upgrade"
reviewers: "username"
commit-message: "chore: Automatic composer upgrade ${{ matrix.branch }} / php-${{ matrix.php }}"
committer: "Username <[email protected]>"
branch: "composer-upgrade-branch-${{ matrix.branch }}"
base: ${{ matrix.branch }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment