From 8c0cf451e2f4f9f1fc03f3ba5f95333d22df88ba Mon Sep 17 00:00:00 2001 From: jiftechnify Date: Sat, 25 Nov 2023 14:02:48 +0900 Subject: [PATCH] try to use ad-m/github-push-action --- .github/workflows/sync.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 15c26d37..28fb910f 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -22,6 +22,7 @@ jobs: with: ref: main fetch-depth: 0 + persist-credentials: false - name: Sync with upstream id: sync @@ -55,10 +56,6 @@ jobs: if ! git diff --quiet main; then echo "diff_main=1" >> $GITHUB_OUTPUT - - echo ::group::Pushing sync branch - git push -f origin sync - echo ::endgroup:: else echo "diff_main=0" >> $GITHUB_OUTPUT echo "main is in sync with upstream" @@ -66,6 +63,13 @@ jobs: env: GITHUB_TOKEN: ${{ steps.create_token.outputs.token }} + - name: Push to sync branch + if: ${{ steps.sync.outputs.diff_main == 1 }} + uses: ad-m/github-push-action@master + with: + github_token: ${{ steps.create_token.outputs.token }} + branch: sync + - name: Check if sync pull request exists id: sync_pr_existence run: | @@ -74,7 +78,7 @@ jobs: GITHUB_TOKEN: ${{ steps.create_token.outputs.token }} - name: Create pull request if needed - if: ${{steps.sync_pr_existence.outputs.count == 0 && steps.sync.outputs.diff_main == 1}} + if: ${{ steps.sync_pr_existence.outputs.count == 0 && steps.sync.outputs.diff_main == 1 }} run: | gh pr create --head "sync" --base "main" --title "Sync with upstream" --body "" env: