|
21 | 21 | type: boolean |
22 | 22 |
|
23 | 23 | permissions: |
24 | | - contents: write |
25 | | - pull-requests: write |
| 24 | + contents: read |
26 | 25 |
|
27 | 26 | jobs: |
28 | 27 | fetch_and_update: |
29 | 28 | name: Sync OpenAPI definition |
30 | 29 | runs-on: ubuntu-latest |
| 30 | + permissions: |
| 31 | + contents: write |
| 32 | + pull-requests: write |
31 | 33 | outputs: |
32 | 34 | has_changes: ${{ steps.check.outputs.has_changes }} |
33 | 35 | steps: |
|
42 | 44 | - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
43 | 45 | with: |
44 | 46 | autocrlf: false |
45 | | - token: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + persist-credentials: false |
46 | 48 |
|
47 | 49 | - uses: SocketDev/socket-registry/.github/actions/setup-and-install@e145a6b355d614054e4df3d49ba5218812f42b3e # main |
48 | 50 |
|
@@ -90,11 +92,16 @@ jobs: |
90 | 92 |
|
91 | 93 | - name: Commit and push changes |
92 | 94 | if: steps.check.outputs.has_changes == 'true' |
| 95 | + env: |
| 96 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
93 | 97 | run: | |
94 | 98 | git checkout -b automated/open-api |
95 | 99 | git add . |
96 | | - git commit -m "fix(openapi): sync with openapi definition" |
97 | | - git push origin automated/open-api -fu --no-verify |
| 100 | + git commit -m "fix(openapi): sync with openapi definition" --no-verify |
| 101 | +
|
| 102 | + # Use gh to push (works with GITHUB_TOKEN in env) |
| 103 | + gh repo set-default ${{ github.repository }} |
| 104 | + git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git automated/open-api -f |
98 | 105 |
|
99 | 106 | - name: Create Pull Request |
100 | 107 | if: steps.check.outputs.has_changes == 'true' |
@@ -131,12 +138,15 @@ jobs: |
131 | 138 | needs: fetch_and_update |
132 | 139 | if: needs.fetch_and_update.outputs.has_changes == 'true' |
133 | 140 | runs-on: ubuntu-latest |
| 141 | + permissions: |
| 142 | + contents: read |
134 | 143 | outputs: |
135 | 144 | has_changes: ${{ steps.check.outputs.has_changes }} |
136 | 145 | steps: |
137 | 146 | - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
138 | 147 | with: |
139 | 148 | autocrlf: false |
| 149 | + persist-credentials: false |
140 | 150 | ref: automated/open-api |
141 | 151 |
|
142 | 152 | - uses: SocketDev/socket-registry/.github/actions/setup-and-install@e145a6b355d614054e4df3d49ba5218812f42b3e # main |
|
0 commit comments