-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify composer update action to use gh client rather than git
- Loading branch information
Showing
1 changed file
with
17 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 "[email protected]" | ||
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 "[email protected]" | ||
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 |