Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2021-10-17 23:10:38 +0300
committerGitHub <noreply@github.com>2021-10-17 23:10:38 +0300
commit6bb1569ebae3794d4a1611b1fab9d47f88708fab (patch)
treeec65257718c408ffcf8ab81cacc05647cdc6f40b /.github
parent2f80606b1db3caaeb4195ff7cd0bf949b2154968 (diff)
Adds action to automatically update composer dependencies (#17969)
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/composer-update.yml95
1 files changed, 95 insertions, 0 deletions
diff --git a/.github/workflows/composer-update.yml b/.github/workflows/composer-update.yml
new file mode 100644
index 0000000000..a16d9e92d7
--- /dev/null
+++ b/.github/workflows/composer-update.yml
@@ -0,0 +1,95 @@
+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@v2
+ with:
+ ref: '4.x-dev'
+ lfs: false
+ - name: Install composer dependencies
+ run: composer install
+ - name: Prepare branches
+ run: |
+ cat <<- EOF > $HOME/.netrc
+ machine github.com
+ login $GITHUB_ACTOR
+ password $GITHUB_TOKEN
+ machine api.github.com
+ login $GITHUB_ACTOR
+ password $GITHUB_TOKEN
+ EOF
+ chmod 600 $HOME/.netrc
+
+ git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
+ git config --global user.name "$GITHUB_ACTOR"
+
+ git remote add upstream https://github.com/${GITHUB_REPOSITORY}.git
+
+ git push origin --delete composer-update || true
+ git branch -D composer-update || true
+ git fetch upstream 4.x-dev
+ git checkout -f upstream/4.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 ::set-output name=message::$(cat COMPOSER_LOG | jq -aRs)
+ shell: bash
+ - name: Push changes
+ run: |
+ git commit -m "updates composer dependencies"
+ git push --set-upstream origin composer-update
+ shell: bash
+ if: steps.update.outputs.message
+ - name: Create PR
+ run: |
+ message=
+ curl \
+ --request POST \
+ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
+ --header 'content-type: application/json' \
+ --data '{
+ "title":"[automatic composer updates]",
+ "body":${{ steps.update.outputs.message }},
+ "head":"composer-update",
+ "base":"4.x-dev"
+ }' \
+ --url https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls
+ shell: bash
+ if: steps.update.outputs.message