From f5b7bbe3b8501ef184147fa886b268ed8a080e6b Mon Sep 17 00:00:00 2001 From: JJGadgets Date: Sat, 8 Nov 2025 18:39:24 +0800 Subject: [PATCH] chore: cleanup --- .github/workflows/renovate-rebase.yaml | 80 +++++++++++++------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/renovate-rebase.yaml b/.github/workflows/renovate-rebase.yaml index 43dee07b..4e13ad4d 100644 --- a/.github/workflows/renovate-rebase.yaml +++ b/.github/workflows/renovate-rebase.yaml @@ -1,41 +1,41 @@ --- -# name: "Renovate Rebase For Automerge" -# -# on: -# workflow_dispatch: -# pull_request: -# types: ["auto_merge_enabled", "closed"] -# branches: ["main"] -# -# jobs: -# rebase-after: -# name: Rebase -# runs-on: ubuntu-latest -# if: startsWith(github.event.pull_request.head.ref,'renovate/') == true -# steps: -# - name: "Generate Short Lived OAuth App Token (ghs_*)" -# uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4 -# id: oauth-token -# with: -# app-id: "${{ secrets.BOT_APP_ID }}" # $BOT_APP_ID is found in GitHub App main settings page -# private-key: "${{ secrets.BOT_JWT_PRIVATE_KEY }}" # $BOT_JWT_PRIVATE_KEY is generated in GitHub App main settings page, uses the X.509 private key format -# owner: "${{ github.repository_owner }}" -# -# - name: Update branch if merged -# if: github.event.pull_request.merged == true -# env: -# GITHUB_TOKEN: "${{ steps.oauth-token.outputs.token }}" -# shell: bash -# run: | -# for i in $(gh pr list --repo ${{ github.event.pull_request.base.repo.full_name }} --author "tinfoild[bot]" --json title,number,autoMergeRequest,headRefName | jq '.[] | select((.autoMergeRequest != null) and (.headRefName | startswith("renovate/"))) | .number'); do -# sha=$(gh pr view ${i} --json headRefOid --jq '.headRefOid' --repo ${{ github.event.pull_request.base.repo.full_name }}) -# gh api --method PUT /repos/${{ github.event.pull_request.base.repo.full_name }}/pulls/${i}/update-branch --field expected_head_sha=${sha} -# done -# -# - name: Update branch if automerge enabled -# if: github.event.action == 'auto_merge_enabled' -# env: -# GITHUB_TOKEN: "${{ steps.oauth-token.outputs.token }}" -# shell: bash -# run: | -# gh api --method PUT /repos/${{ github.event.pull_request.base.repo.full_name }}/pulls/${{ github.event.pull_request.number }}/update-branch --field expected_head_sha=${{ github.event.pull_request.head.sha }} +name: "Renovate Rebase For Automerge" + +on: + workflow_dispatch: + pull_request: + types: ["auto_merge_enabled", "closed"] + branches: ["main"] + +jobs: + rebase-after: + name: Rebase + runs-on: ubuntu-latest + if: startsWith(github.event.pull_request.head.ref,'renovate/') == true + steps: + - name: "Generate Short Lived OAuth App Token (ghs_*)" + uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4 + id: oauth-token + with: + app-id: "${{ secrets.BOT_APP_ID }}" # $BOT_APP_ID is found in GitHub App main settings page + private-key: "${{ secrets.BOT_JWT_PRIVATE_KEY }}" # $BOT_JWT_PRIVATE_KEY is generated in GitHub App main settings page, uses the X.509 private key format + owner: "${{ github.repository_owner }}" + + - name: Update branch if merged + if: github.event.pull_request.merged == true + env: + GITHUB_TOKEN: "${{ steps.oauth-token.outputs.token }}" + shell: bash + run: | + for i in $(gh pr list --repo ${{ github.event.pull_request.base.repo.full_name }} --author "tinfoild[bot]" --json title,number,autoMergeRequest,headRefName | jq '.[] | select((.autoMergeRequest != null) and (.headRefName | startswith("renovate/"))) | .number'); do + sha=$(gh pr view ${i} --json headRefOid --jq '.headRefOid' --repo ${{ github.event.pull_request.base.repo.full_name }}) + gh api --method PUT /repos/${{ github.event.pull_request.base.repo.full_name }}/pulls/${i}/update-branch --field expected_head_sha=${sha} + done + + - name: Update branch if automerge enabled + if: github.event.action == 'auto_merge_enabled' + env: + GITHUB_TOKEN: "${{ steps.oauth-token.outputs.token }}" + shell: bash + run: | + gh api --method PUT /repos/${{ github.event.pull_request.base.repo.full_name }}/pulls/${{ github.event.pull_request.number }}/update-branch --field expected_head_sha=${{ github.event.pull_request.head.sha }}