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
This commit is contained in:
2024-07-01 16:43:26 +07:00
parent e20bcbf6b6
commit 97cd8be045

View File

@@ -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