Skip to content

Commit a423662

Browse files
authored
Follow-up fixes to updater-schemas workflow (#492)
* Follow-up fixes to updater-schemas workflow See #491 * Set permissions
1 parent ac65de6 commit a423662

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎.github/workflows/update-schemas.yml‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ concurrency:
1717
group: ${{ github.workflow }}-${{ github.ref }}
1818
cancel-in-progress: true
1919

20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
2024
jobs:
2125

2226
update-schemas: #----------------------------------------------------------
@@ -33,7 +37,7 @@ jobs:
3337
3438
- name: Commit and Create Pull Request
3539
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
GH_TOKEN: ${{ github.token }}
3741
PR_BODY: |
3842
**This is an automated pull-request**
3943
@@ -47,10 +51,9 @@ jobs:
4751
git checkout -b update-schemas
4852
git add assets/
4953
git commit -m "Update schema fallback files"
50-
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
5154
git push -f origin update-schemas
5255
53-
PR_NUMBER=$(gh pr list --head update-schemas --json number --jq '.[0].number')
56+
PR_NUMBER=$(gh pr list --head update-schemas --json number --jq '.[0].number // empty')
5457
if [ -z "$PR_NUMBER" ]; then
5558
gh pr create \
5659
--title "Update schema fallback files" \
@@ -59,6 +62,13 @@ jobs:
5962
--base "${{ github.event.repository.default_branch }}" \
6063
--head "update-schemas" \
6164
--reviewer "swissspidy"
65+
else
66+
gh pr edit "$PR_NUMBER" \
67+
--title "Update schema fallback files" \
68+
--body "$PR_BODY" \
69+
--add-label "scope:distribution" \
70+
--base "${{ github.event.repository.default_branch }}"
6271
fi
72+
6373
fi
6474

0 commit comments

Comments
 (0)