Skip to content
Merged
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
29 changes: 24 additions & 5 deletions .github/scripts/check_heavy_ci_gate.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# Decide whether an expensive PR CI workflow should run.
# Non-PR events keep their existing behavior. For PR events, run only when the
# current event explicitly adds one of CI_GATE_LABELS, or the PR has any
# historical APPROVED review.
# Non-PR events keep their existing behavior. For PR events, run when the PR
# currently has one of CI_GATE_LABELS, or the PR has any historical APPROVED
# review.

set -euo pipefail

Expand Down Expand Up @@ -34,6 +34,24 @@ label_is_allowed() {
return 1
}

find_allowed_pr_label() {
local labels label
labels="$(jq -r '.pull_request.labels[]?.name // empty' "${EVENT_PATH}")"

if [ -z "${labels}" ] && [ -n "${REPO:-}" ] && [ -n "${PR_NUMBER:-}" ]; then
labels="$(gh api --paginate "repos/${REPO}/issues/${PR_NUMBER}/labels" --jq '.[].name' 2>/dev/null || true)"
fi

while IFS= read -r label; do
if [ -n "${label}" ] && label_is_allowed "${label}"; then
printf '%s\n' "${label}"
return 0
fi
done <<< "${labels}"

return 1
}

check_relevant_paths() {
if [ -z "${CI_GATE_PATHS_IGNORE:-}" ]; then
return 0
Expand Down Expand Up @@ -178,8 +196,9 @@ fi
OWNER="${REPO%%/*}"
NAME="${REPO#*/}"

if [ "${ACTION}" = "labeled" ] && label_is_allowed "${EVENT_LABEL}"; then
emit_decision "true" "manual-label" "${EVENT_LABEL}"
MATCHED_LABEL="$(find_allowed_pr_label || true)"
if [ -n "${MATCHED_LABEL}" ]; then
Comment on lines 196 to +200
emit_decision "true" "label-present" "${MATCHED_LABEL}"
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-welcome-comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
"| `ci:vllm` | Run ATOM vLLM OOT model accuracy tests |",
"| `ci:sglang` | Run ATOM SGLang model accuracy tests |",
"",
"> Heavy jobs are skipped when the PR is not approved and no matching `ci:*` label was just added.",
"> Heavy jobs are skipped when the PR is not approved and no matching `ci:*` label is present.",
`> Add labels via the sidebar or \`gh pr edit ${context.issue.number} --add-label <label>\``,
].join("\n");

Expand Down
Loading