diff --git a/.github/workflows/composer-update.yml b/.github/workflows/composer-update.yml index 8bdcf308dc0f..9ce95f1c0519 100644 --- a/.github/workflows/composer-update.yml +++ b/.github/workflows/composer-update.yml @@ -32,28 +32,17 @@ jobs: 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 set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY - - 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 5.x-dev - git checkout -f upstream/5.x-dev - git branch composer-update - git checkout -f composer-update + gh auth setup-git + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" + git config --global user.name "$GITHUB_ACTOR" + gh repo sync + git push origin --delete composer-update || true + git branch -D composer-update || true + git checkout -f 5.x-dev + git branch composer-update + git checkout -f composer-update + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Update composer dependencies id: update run: | @@ -75,23 +64,14 @@ jobs: shell: bash - name: Push changes run: | - git commit -m "Update composer dependencies" - git push --set-upstream origin composer-update + gh auth setup-git + git commit -m "Update 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":"5.x-dev" - }' \ - --url https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls - shell: bash + 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