From 39e5f38bac8c297effecbfad460e5e5d60178a0b Mon Sep 17 00:00:00 2001 From: lucaspopp-wbd Date: Tue, 4 Nov 2025 12:57:16 -0800 Subject: [PATCH 1/2] generate as app --- .github/workflows/generate.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index c9589f3..2226b85 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -7,6 +7,11 @@ on: pr-base: required: true type: string + secrets: + ORG_ISP_WRITER_APP_ID: + required: true + ORG_ISP_WRITER_APP_PRIVATE_KEY: + required: true outputs: pr-number: description: pr number @@ -33,8 +38,15 @@ jobs: pr-number: ${{ steps.create-pr.outputs.pull-request-number }} steps: + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ secrets.ORG_ISP_WRITER_APP_ID }} + private-key: ${{ secrets.ORG_ISP_WRITER_APP_PRIVATE_KEY }} + - uses: actions/checkout@v4 with: + token: ${{ steps.app-token.outputs.token }} submodules: recursive - name: Determine base branch name @@ -80,6 +92,7 @@ jobs: if: steps.changes.outputs.should-commit == 'true' uses: peter-evans/create-pull-request@v6 with: + token: ${{ steps.app-token.outputs.token }} commit-message: "re-generate sdk" branch: ${{ steps.pr-head.outputs.name }} base: ${{ steps.pr-base.outputs.name }} From c0c6ea0052781d72903c2de3d5f05fae7c84d7c4 Mon Sep 17 00:00:00 2001 From: lucaspopp-wbd Date: Tue, 4 Nov 2025 13:09:10 -0800 Subject: [PATCH 2/2] goodbye peter-evans --- .github/workflows/generate.yml | 43 ++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 2226b85..c20d39b 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -78,7 +78,6 @@ jobs: - name: Detect generated changes id: changes run: | - git add isp isp-slate isp-lifecycle git status if [ -n "$(git status -s)" ]; then @@ -86,21 +85,45 @@ jobs: else echo "should-commit=false" | tee -a "$GITHUB_OUTPUT" fi - - - name: Create Pull Request - id: create-pr + + - name: Create and push branch if: steps.changes.outputs.should-commit == 'true' - uses: peter-evans/create-pull-request@v6 + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -b ${{ steps.pr-head.outputs.name }} + git push -u origin ${{ steps.pr-head.outputs.name }} + + - name: Commit changes + if: steps.changes.outputs.should-commit == 'true' + uses: planetscale/ghcommit-action@v0.2.0 + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} with: - token: ${{ steps.app-token.outputs.token }} - commit-message: "re-generate sdk" + commit_message: "re-generate sdk" + repo: ${{ github.repository }} branch: ${{ steps.pr-head.outputs.name }} - base: ${{ steps.pr-base.outputs.name }} - title: 'chore: bump sdk version' - body: | + file_pattern: 'isp isp-slate isp-lifecycle' + + - name: Create Pull Request + id: create-pr + if: steps.changes.outputs.should-commit == 'true' + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + PR_BODY: | Generated by [${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) Comment `recreate-me` on this pull request to have it closed and re-created + run: | + PR_URL=$(gh pr create \ + --title "chore: bump sdk version" \ + --body "$PR_BODY" \ + --base ${{ steps.pr-base.outputs.name }} \ + --head ${{ steps.pr-head.outputs.name }}) + + PR_NUMBER=$(echo "$PR_URL" | grep -o '[0-9]\+$') + echo "pull-request-number=$PR_NUMBER" >> "$GITHUB_OUTPUT" + echo "pull-request-url=$PR_URL" >> "$GITHUB_OUTPUT" - name: Print summary if: steps.changes.outputs.should-commit == 'true'