Skip to content

Composer update

Composer update #179

Workflow file for this run

name: Composer update
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * 5"
permissions:
actions: read
checks: none
contents: write
deployments: none
issues: read
packages: none
pull-requests: write
repository-projects: none
security-events: none
statuses: none
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: '5.x-dev'
lfs: false
persist-credentials: false
- name: Install composer dependencies
run: composer install
- name: Prepare branches
run: |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
git config --global user.email "[email protected]"
git config --global user.name "$GITHUB_ACTOR"
gh repo set-default ${GITHUB_REPOSITORY}
gh repo sync
git push origin --delete composer-update || true
git branch -D composer-update || true
git fetch upstream 5.x-dev
git checkout -f upstream/5.x-dev
git branch composer-update
git checkout -f composer-update
- name: Update composer dependencies
id: update
run: |
composer update --no-ansi 2>&1 | tee COMPOSER_LOG
sed -i -e '1i```\' COMPOSER_LOG
sed -i -e '1icomposer update log:\' COMPOSER_LOG
echo '```' &>> COMPOSER_LOG
changes=( $(git diff composer.lock) )
git add "composer.lock"
# abort here if no change available
if [[ ${#changes[@]} -eq 0 ]]
then
exit 0
fi
echo "message=$(cat COMPOSER_LOG | jq -aRs)" >> $GITHUB_OUTPUT
shell: bash
- name: Push changes
run: |
git commit -m "Update composer dependencies"
git push --set-upstream origin composer-update
shell: bash
if: steps.update.outputs.message
- name: Create PR
run: |
gh pr create -B 5.x-dev -H composer-update --title '[automatic composer updates]' --body '${{ steps.update.outputs.message }},'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.update.outputs.message