mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-17 05:31:16 +08:00
68 lines
2.3 KiB
YAML
68 lines
2.3 KiB
YAML
name: E2E Gate
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, labeled, unlabeled, ready_for_review]
|
|
workflow_run:
|
|
workflows: ["Branch E2E Checks", "GPU Test"]
|
|
types: [completed]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
# On PR events, actually evaluate the gate — these runs post their check
|
|
# result to the PR's head SHA, which is what branch protection sees.
|
|
e2e:
|
|
name: E2E
|
|
if: github.event_name == 'pull_request'
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
actions: read
|
|
uses: ./.github/workflows/e2e-gate-check.yml
|
|
with:
|
|
required_label: test:e2e
|
|
workflow_file: branch-e2e.yml
|
|
|
|
gpu:
|
|
name: GPU E2E
|
|
if: github.event_name == 'pull_request'
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
actions: read
|
|
uses: ./.github/workflows/e2e-gate-check.yml
|
|
with:
|
|
required_label: test:e2e-gpu
|
|
workflow_file: test-gpu.yml
|
|
|
|
# When the guarded workflow finishes, GitHub fires `workflow_run` in the
|
|
# default-branch context — any check posted from here would land on `main`,
|
|
# not on the PR. Instead, find the latest `pull_request`-triggered gate run
|
|
# for the same head SHA and ask the API to re-run it. The re-run replays the
|
|
# original event (labels, head SHA) so the check posts to the PR again, and
|
|
# this time the gate sees the successful upstream run.
|
|
rerun-on-completion:
|
|
name: Re-run gate in PR context
|
|
if: github.event_name == 'workflow_run'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
actions: write
|
|
steps:
|
|
- name: Rerun latest PR-context gate for this SHA
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
run_id=$(gh api "repos/$GH_REPO/actions/workflows/e2e-gate.yml/runs?event=pull_request&head_sha=$HEAD_SHA" \
|
|
--jq '.workflow_runs | sort_by(.created_at) | reverse | .[0].id // empty')
|
|
if [ -z "$run_id" ]; then
|
|
echo "No pull_request-triggered E2E Gate run found for $HEAD_SHA — nothing to re-run."
|
|
exit 0
|
|
fi
|
|
echo "Re-running E2E Gate run $run_id so it re-evaluates and posts a fresh check on the PR."
|
|
gh api --method POST "repos/$GH_REPO/actions/runs/$run_id/rerun"
|