diff --git a/.github/workflows/update-schemas.yml b/.github/workflows/update-schemas.yml index e8fa94d..6822fae 100644 --- a/.github/workflows/update-schemas.yml +++ b/.github/workflows/update-schemas.yml @@ -17,6 +17,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: write + pull-requests: write + jobs: update-schemas: #---------------------------------------------------------- @@ -33,7 +37,7 @@ jobs: - name: Commit and Create Pull Request env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ github.token }} PR_BODY: | **This is an automated pull-request** @@ -47,10 +51,9 @@ jobs: git checkout -b update-schemas git add assets/ git commit -m "Update schema fallback files" - git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git git push -f origin update-schemas - PR_NUMBER=$(gh pr list --head update-schemas --json number --jq '.[0].number') + PR_NUMBER=$(gh pr list --head update-schemas --json number --jq '.[0].number // empty') if [ -z "$PR_NUMBER" ]; then gh pr create \ --title "Update schema fallback files" \ @@ -59,6 +62,13 @@ jobs: --base "${{ github.event.repository.default_branch }}" \ --head "update-schemas" \ --reviewer "swissspidy" + else + gh pr edit "$PR_NUMBER" \ + --title "Update schema fallback files" \ + --body "$PR_BODY" \ + --add-label "scope:distribution" \ + --base "${{ github.event.repository.default_branch }}" fi + fi