Skip to content

Instantly share code, notes, and snippets.

@wilsenhc
Last active August 3, 2023 03:20
Show Gist options
  • Save wilsenhc/0bcddc943fccce3c7d3ff3e5231fad70 to your computer and use it in GitHub Desktop.
Save wilsenhc/0bcddc943fccce3c7d3ff3e5231fad70 to your computer and use it in GitHub Desktop.
GitHub Action to automatically upgrade Composer dependencies based on a Cron Schedule
name: Automatic composer upgrade
on:
schedule:
- cron: '0 0 1 * *'
jobs:
types:
runs-on: ubuntu-latest
name: Automatic composer upgrade
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
# For supported PHP versions see: https://github.com/shivammathur/setup-php#tada-php-support
php-version: 8.2
tools: composer:v2
coverage: none
# Automatically run composer upgrade
- name: Upgrade dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: "[chore] Automatic scheduled composer upgrade"
commit-message: "[ci skip] Automatic composer upgrade"
branch: "composer-upgrade"
# This is NOT recommended in any way but,
# If instead of creating a PR you want to directly commit the changes,
# remove the previous step and uncomment this one
# - name: Commit composer upgrade
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: "[ci skip] Automatic composer upgrade"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment