Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Automatically bump the Composer root version #879

Merged
merged 13 commits into from
Nov 2, 2023
47 changes: 47 additions & 0 deletions .github/workflows/composer-root-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,50 @@ jobs:
- name: Failing run
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1

update-composer-root-version:
name: Update the Composer root version
if: ${{ github.repository == 'humbug/php-scoper' && github.ref_name == 'main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: '0' # Ensures the tags are fetched
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer
coverage: none

- name: Install the Composer dependencies
uses: ramsey/composer-install@v2
with:
working-directory: 'composer-root-version-checker'

- name: Dump the Composer too version
run: cd composer-root-version-checker; make dump_root_version

- name: Check for changes
run: |
if [ $(git status --porcelain | wc -l) -eq "0" ]; then
echo "🟢 No change detected."
echo "composer_root_version_changed=false" >> $GITHUB_ENV
else
echo "composer_root_version_changed=true" >> $GITHUB_ENV
fi

- name: Create Pull Request
if: env.composer_root_version == 'true'
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch-suffix: random
delete-branch: true
title: "build: Update the Composer root version"
committer: "php-scoper-bot <[email protected]>"
commit-message: "Update the Composer root version"