feat(renovate): use proper gh command in rebase workflow

This commit is contained in:
JJGadgets
2025-11-26 23:28:55 +08:00
parent de32c60f26
commit 86e8adc4af

View File

@@ -7,6 +7,10 @@ on:
types: ["auto_merge_enabled", "closed"]
branches: ["main"]
concurrency:
cancel-in-progress: true
group: "${{ github.ref }}"
jobs:
rebase-after:
name: Rebase
@@ -28,9 +32,12 @@ jobs:
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}
echo "i = ${i}"
# sha=$(gh pr view ${i} --json headRefOid --jq '.headRefOid' --repo ${{ github.event.pull_request.base.repo.full_name }})
# echo "sha = ${sha}"
gh pr update-branch ${i} --repo ${{ github.event.pull_request.base.repo.full_name }}
done
# gh api --method PUT /repos/${{ github.event.pull_request.base.repo.full_name }}/pulls/${i}/update-branch --field expected_head_sha=${sha}
- name: Update branch if automerge enabled
if: github.event.action == 'auto_merge_enabled'
@@ -38,4 +45,5 @@ jobs:
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 }}
gh pr update-branch ${{ github.event.pull_request.number }} --repo ${{ github.event.pull_request.base.repo.full_name }}
# 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 }}