From 97cd8be045642e21ef84882aeba55588054a8381 Mon Sep 17 00:00:00 2001 From: Natsu Date: Mon, 1 Jul 2024 16:43:26 +0700 Subject: [PATCH] chore(check.yml): add write permission for pull-requests chore(check.yml): update git push command to push to the correct branch based on event type --- .github/workflows/check.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6f29509b..bcfe137a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -42,6 +42,7 @@ jobs: permissions: contents: write + pull-requests: write steps: - name: Checkout @@ -70,7 +71,11 @@ jobs: run: | git add local-files/*.json local-files/**/*.json git commit -m "chore(format): Format and Sort JSON files" - git push origin main + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + git push origin HEAD:${{ github.head_ref }} + else + git push origin main + fi env: GITHUB_TOKEN: ${{ secrets.PAT }} continue-on-error: true