Last active
August 3, 2023 03:20
-
-
Save wilsenhc/0bcddc943fccce3c7d3ff3e5231fad70 to your computer and use it in GitHub Desktop.
GitHub Action to automatically upgrade Composer dependencies based on a Cron Schedule
This file contains hidden or 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: 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