Skip to content

Commit 625c41e

Browse files
authored
ci: Automatically bump the Composer root version (#879)
Closes #786.
1 parent 1937aca commit 625c41e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/composer-root-version.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,50 @@ jobs:
100100
- name: Failing run
101101
if: ${{ contains(needs.*.result, 'failure') }}
102102
run: exit 1
103+
104+
update-composer-root-version:
105+
name: Update the Composer root version
106+
if: ${{ github.repository == 'humbug/php-scoper' && github.ref_name == 'main' }}
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: Checkout
110+
uses: actions/checkout@v4
111+
with:
112+
ref: ${{ github.head_ref }}
113+
fetch-depth: '0' # Ensures the tags are fetched
114+
token: ${{ secrets.GITHUB_TOKEN }}
115+
116+
- name: Setup PHP
117+
uses: shivammathur/setup-php@v2
118+
with:
119+
php-version: '8.1'
120+
tools: composer
121+
coverage: none
122+
123+
- name: Install the Composer dependencies
124+
uses: ramsey/composer-install@v2
125+
with:
126+
working-directory: 'composer-root-version-checker'
127+
128+
- name: Dump the Composer too version
129+
run: cd composer-root-version-checker; make dump_root_version
130+
131+
- name: Check for changes
132+
run: |
133+
if [ $(git status --porcelain | wc -l) -eq "0" ]; then
134+
echo "🟢 No change detected."
135+
echo "composer_root_version_changed=false" >> $GITHUB_ENV
136+
else
137+
echo "composer_root_version_changed=true" >> $GITHUB_ENV
138+
fi
139+
140+
- name: Create Pull Request
141+
if: env.composer_root_version == 'true'
142+
uses: peter-evans/create-pull-request@v4
143+
with:
144+
token: ${{ secrets.GITHUB_TOKEN }}
145+
branch-suffix: random
146+
delete-branch: true
147+
title: "build: Update the Composer root version"
148+
committer: "php-scoper-bot <[email protected]>"
149+
commit-message: "Update the Composer root version"

0 commit comments

Comments
 (0)