Update auto_merge_renovate_prs.yml

This commit is contained in:
2025-09-17 13:17:37 +08:00
committed by GitHub
parent 5bfbb23eac
commit 4c21e13bdd
@@ -3,7 +3,7 @@ name: Merge Renovate PRs
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: "*/10 * * * *" # 每10分钟跑一次 - cron: "*/10 * * * *"
permissions: permissions:
contents: read contents: read
@@ -23,11 +23,15 @@ jobs:
- name: List open Renovate PRs - name: List open Renovate PRs
id: list id: list
run: | run: |
prs=$(gh pr list --repo "$GITHUB_REPOSITORY" --state open \ # 获取 renovate / mend-renovate PR numbers
mapfile -t prs < <(gh pr list --repo "$GITHUB_REPOSITORY" --state open \
--json number,author \ --json number,author \
--jq '.[] | select(.author.login | test("renovate|mend-renovate"; "i")) | .number') --jq '.[] | select(.author.login | test("renovate|mend-renovate"; "i")) | .number')
prs_json=$(printf '%s\n' "$prs" | jq -R . | jq -s .)
# 输出到 GitHub Actions 输出
prs_json=$(printf '%s\n' "${prs[@]}" | jq -R . | jq -s .)
echo "prs=$prs_json" >> $GITHUB_OUTPUT echo "prs=$prs_json" >> $GITHUB_OUTPUT
echo "Found PRs: ${prs[*]}"
- name: Poll and merge Renovate PRs - name: Poll and merge Renovate PRs
if: steps.list.outputs.prs != '[]' if: steps.list.outputs.prs != '[]'
@@ -59,11 +63,11 @@ jobs:
break break
fi fi
echo "Checks not green. Waiting 10 minutes before next attempt..." echo "Checks not green. Waiting 10 minutes..."
sleep 600 sleep 600
done done
if [[ "$merged" == false ]]; then if [[ "$merged" == false ]]; then
echo "⚠️ PR #$pr could not be merged after 3 attempts. Moving on." echo "⚠️ PR #$pr could not be merged after 3 attempts."
fi fi
done done