Try fix the max-parallel for maunally triggered test again. (#18686)

This commit is contained in:
Liangsheng Yin
2026-02-11 20:08:25 -08:00
committed by GitHub
parent e422bcaed8
commit 3404dda592

View File

@@ -209,10 +209,20 @@ jobs:
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ contains(github.event.pull_request.labels.*.name, 'high priority') }}" == "true" ]]; then
echo "max_parallel=14" >> $GITHUB_OUTPUT
echo "High priority PR detected, setting max_parallel to 14"
elif [[ -n "${{ inputs.pr_head_sha }}" ]]; then
elif [[ -n "${{ inputs.target_stage }}" ]]; then
# /rerun-stage (workflow_dispatch): query PR labels via GitHub API
LABELS=$(gh api "repos/${{ github.repository }}/commits/${{ inputs.pr_head_sha }}/pulls" \
--jq '.[0].labels[].name' 2>/dev/null || true)
# Try SHA lookup first (fork PRs), fallback to branch name (non-fork PRs)
LABELS=""
PR_HEAD_SHA="${{ inputs.pr_head_sha }}"
if [[ -n "$PR_HEAD_SHA" ]]; then
LABELS=$(gh api "repos/${{ github.repository }}/commits/${PR_HEAD_SHA}/pulls" \
--jq '.[0].labels[].name' 2>/dev/null || true)
fi
if [[ -z "$LABELS" ]]; then
LABELS=$(gh pr list --head "${{ github.ref_name }}" --repo "${{ github.repository }}" \
--json labels --jq '.[0].labels[].name' 2>/dev/null || true)
fi
echo "PR labels: ${LABELS:-"(none)"}"
if echo "$LABELS" | grep -Fxq "high priority"; then
echo "max_parallel=14" >> $GITHUB_OUTPUT
echo "High priority PR detected via API (/rerun-stage), setting max_parallel to 14"