@@ -66,19 +66,28 @@ jobs:
6666 pull-requests : write
6767 steps :
6868 - name : Authenticate as GitHub App
69- if : ${{ !inputs.dry_run && github.event.inputs.pr != '' }}
69+ if : ${{ !inputs.dry_run && github.event.inputs.pr != '' && secrets.OCTAVIA_BOT_APP_ID != '' }}
7070 uses : actions/create-github-app-token@v3
7171 id : get-app-token
7272 with :
7373 app-id : ${{ secrets.OCTAVIA_BOT_APP_ID }}
7474 private-key : ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }}
7575
76+ - name : Set working token
77+ id : token
78+ run : |
79+ if [ -n "${{ steps.get-app-token.outputs.token }}" ]; then
80+ echo "token=${{ steps.get-app-token.outputs.token }}" >> $GITHUB_OUTPUT
81+ else
82+ echo "token=${{ github.token }}" >> $GITHUB_OUTPUT
83+ fi
84+
7685 - name : Post or append starting comment
7786 if : ${{ !inputs.dry_run && github.event.inputs.pr != '' }}
7887 id : start-comment
7988 uses : peter-evans/create-or-update-comment@v5
8089 with :
81- token : ${{ steps.get-app- token.outputs.token }}
90+ token : ${{ steps.token.outputs.token }}
8291 issue-number : ${{ github.event.inputs.pr }}
8392 comment-id : ${{ github.event.inputs.comment-id || '' }}
8493 body : |
92101 if : ${{ !inputs.dry_run && github.event.inputs.pr != '' }}
93102 id : pr-branch
94103 env :
95- GH_TOKEN : ${{ steps.get-app- token.outputs.token }}
104+ GH_TOKEN : ${{ steps.token.outputs.token }}
96105 PR_NUMBER : ${{ github.event.inputs.pr }}
97106 run : |
98107 PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${PR_NUMBER})
@@ -109,7 +118,7 @@ jobs:
109118 with :
110119 fetch-depth : 0
111120 ref : ${{ steps.pr-branch.outputs.head_ref || '' }}
112- token : ${{ steps.get-app- token.outputs.token || github.token }}
121+ token : ${{ steps.token.outputs.token || github.token }}
113122
114123 - name : Install uv
115124 uses : astral-sh/setup-uv@v5
@@ -203,20 +212,12 @@ jobs:
203212 git push
204213
205214 # --- New PR mode: create a PR to main ---
206- - name : Authenticate as GitHub App for PR creation
207- if : ${{ !inputs.dry_run && steps.changes.outputs.has_changes == 'true' && github.event.inputs.pr == '' }}
208- uses : actions/create-github-app-token@v3
209- id : get-pr-token
210- with :
211- app-id : ${{ secrets.OCTAVIA_BOT_APP_ID }}
212- private-key : ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }}
213-
214215 - name : Create Pull Request
215216 if : ${{ !inputs.dry_run && steps.changes.outputs.has_changes == 'true' && github.event.inputs.pr == '' }}
216217 id : create-pr
217218 uses : peter-evans/create-pull-request@v6
218219 with :
219- token : ${{ steps.get-pr- token.outputs.token }}
220+ token : ${{ steps.token.outputs.token }}
220221 commit-message : " chore: regenerate SDK with Speakeasy"
221222 title : " chore: regenerate SDK with Speakeasy"
222223 body : |
@@ -240,7 +241,7 @@ jobs:
240241 if : ${{ success() && !inputs.dry_run && github.event.inputs.pr != '' }}
241242 uses : peter-evans/create-or-update-comment@v5
242243 with :
243- token : ${{ steps.get-app- token.outputs.token }}
244+ token : ${{ steps.token.outputs.token }}
244245 comment-id : ${{ steps.start-comment.outputs.comment-id }}
245246 reactions : hooray
246247 body : |
@@ -250,7 +251,7 @@ jobs:
250251 if : ${{ failure() && !inputs.dry_run && github.event.inputs.pr != '' }}
251252 uses : peter-evans/create-or-update-comment@v5
252253 with :
253- token : ${{ steps.get-app- token.outputs.token }}
254+ token : ${{ steps.token.outputs.token }}
254255 comment-id : ${{ steps.start-comment.outputs.comment-id }}
255256 reactions : confused
256257 body : |
0 commit comments