镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/commit-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-slim
outputs:
aged_prs: ${{ steps.get_candidate_prs.outputs.aged_prs }}
candidates: ${{ steps.get_candidate_prs.outputs.candidates }}
steps:
- name: Get Pull Request Candidates
Expand All @@ -50,6 +51,7 @@ jobs:
--search "-label:blocked")
candidates=$(printf '%s %s\n' "$fast_track_prs" "$aged_prs" |
jq -r -s 'reduce .[] as $pr ([]; if index($pr) then . else . + [$pr] end) | join(" ")')
echo "aged_prs=$aged_prs" >> "$GITHUB_OUTPUT"
echo "candidates=$candidates" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -93,6 +95,7 @@ jobs:
curl -fsSLo "$readme" "https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/README.md"

numbers=
lacks_second_approval_prs=
# shellcheck disable=SC2086
for pr in $CANDIDATES; do
metadata="${RUNNER_TEMP}/metadata-${pr}.json"
Expand Down Expand Up @@ -139,6 +142,14 @@ jobs:
if [ "$metadata_status" -ge 20 ] && [ "$metadata_status" -le 29 ]; then
echo "pr ${pr} skipped, not ready to land"
echo "reason codes: ${metadata_reason_codes}"
if jq -e '
(.reasonCodes | index("wait-time")) and
(.pullRequest.labels | index("lacks-second-approval") | not)
' "$metadata" > /dev/null; then
case " $AGED_PRS " in
*" $pr "*) lacks_second_approval_prs="$lacks_second_approval_prs $pr" ;;
esac
fi
continue
fi

Expand All @@ -148,11 +159,27 @@ jobs:
done

numbers=$(echo "$numbers" | xargs)
lacks_second_approval_prs=$(echo "$lacks_second_approval_prs" | xargs)
echo "numbers=$numbers" >> "$GITHUB_OUTPUT"
echo "lacks_second_approval_prs=$lacks_second_approval_prs" >> "$GITHUB_OUTPUT"
env:
AGED_PRS: ${{ needs.get_candidate_prs.outputs.aged_prs }}
CANDIDATES: ${{ needs.get_candidate_prs.outputs.candidates }}
GH_TOKEN: ${{ github.token }}

- name: Label Pull Requests Lacking a Second Approval
if: steps.get_mergeable_prs.outputs.lacks_second_approval_prs != ''
run: |
# shellcheck disable=SC2086
for pr in $PULL_REQUESTS; do
if ! gh -R "$GITHUB_REPOSITORY" pr edit "$pr" --add-label 'lacks-second-approval'; then
echo "::warning::Failed to add lacks-second-approval to PR ${pr}"
fi
done
env:
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
PULL_REQUESTS: ${{ steps.get_mergeable_prs.outputs.lacks_second_approval_prs }}

- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
if: steps.get_mergeable_prs.outputs.numbers != ''
with:
Expand Down
Loading
Loading