Update auto_merge_renovate_prs.yml

This commit is contained in:
Meng Sen
2025-09-17 13:17:37 +08:00
committed by GitHub
parent 5bfbb23eac
commit 4c21e13bdd

View File

@@ -3,7 +3,7 @@ name: Merge Renovate PRs
on:
workflow_dispatch:
schedule:
- cron: "*/10 * * * *" # 每10分钟跑一次
- cron: "*/10 * * * *"
permissions:
contents: read
@@ -23,11 +23,15 @@ jobs:
- name: List open Renovate PRs
id: list
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 \
--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 "Found PRs: ${prs[*]}"
- name: Poll and merge Renovate PRs
if: steps.list.outputs.prs != '[]'
@@ -59,11 +63,11 @@ jobs:
break
fi
echo "Checks not green. Waiting 10 minutes before next attempt..."
echo "Checks not green. Waiting 10 minutes..."
sleep 600
done
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
done