Repository navigation
Merge main into yifuw/swe-egress-block-no-verdict-masks #15754
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: CICD NeMo Gym | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "pull-request/[0-9]+" | |
| merge_group: | |
| types: [checks_requested] | |
| schedule: | |
| - cron: "0 */4 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| send_notification: | |
| description: Send a Slack notification to the Gym alerts channel on failure | |
| required: false | |
| default: true | |
| type: boolean | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: ${{ github.event_name != 'schedule' }} | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| ephemeral-runner-routing: | |
| uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_ephemeral_runner_routing.yml@f47f58bcf571d7dee8678e0fc5f6eec7800dadd4 | |
| with: | |
| lane: ${{ vars.NEMO_CI_EPHEMERAL_LANE }} | |
| legacy_label: ${{ vars.NON_NVIDIA_RUNNER_PREFIX }} | |
| run_id: ${{ github.run_id }} | |
| run_attempt: ${{ github.run_attempt }} | |
| pre-flight: | |
| needs: [ephemeral-runner-routing] | |
| uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_cicd_preflight.yml@f47f58bcf571d7dee8678e0fc5f6eec7800dadd4 | |
| with: | |
| default_runner_prefix: ${{ vars.DEFAULT_RUNNER_PREFIX }} | |
| non_nvidia_runner_prefix: ${{ needs.ephemeral-runner-routing.outputs.runner_label_base }} | |
| default_test_data_path: ${{ vars.DEFAULT_TEST_DATA_PATH }} | |
| non_nvidia_test_data_path: ${{ vars.NON_NVIDIA_TEST_DATA_PATH }} | |
| default_registry: ${{ vars.DEFAULT_CONTAINER_REGISTRY }} | |
| non_nvidia_registry: ${{ vars.NON_NVIDIA_CONTAINER_REGISTRY }} | |
| sso_users_filename: ${{ vars.SSO_USERS_FILENAME }} | |
| secrets: | |
| NVIDIA_MANAGEMENT_ORG_PAT: ${{ secrets.NVIDIA_MANAGEMENT_ORG_PAT }} | |
| classify_changes: | |
| name: Classify changes | |
| needs: [pre-flight] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| sha: ${{ steps.revision.outputs.sha }} | |
| docs_only: ${{ steps.changes.outputs.docs_only }} | |
| # Single source of truth for "is this a periodic/on-demand run" - | |
| # referenced by container_build/gpu_e2e_tests/provider_e2e_tests and | |
| # Nemo_CICD_Test instead of each re-deriving it. NOT used by | |
| # notify-failure, which checks github.event_name directly since it | |
| # must still fire even if this job was skipped (e.g. pre-flight | |
| # failed) - a skipped job's outputs, including literal ones, are empty. | |
| is_nightly: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} | |
| steps: | |
| # Resolve once: PR-mirror pushes must test the merge, not the unmerged head. | |
| - name: Resolve tested revision | |
| id: revision | |
| shell: bash -e -u -o pipefail {0} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| REF_NAME: ${{ github.ref_name }} | |
| EVENT_SHA: ${{ github.sha }} | |
| MERGE_GROUP_SHA: ${{ github.event.merge_group.head_sha }} | |
| run: | | |
| sha="$EVENT_SHA" | |
| if [[ "$EVENT_NAME" == push && "$REF_NAME" =~ ^pull-request/([0-9]+)$ ]]; then | |
| pr_info=$(gh api "repos/$GITHUB_REPOSITORY/pulls/${BASH_REMATCH[1]}" \ | |
| --jq '.head.sha + " " + (.merge_commit_sha // "")') | |
| read -r pr_head sha <<< "$pr_info" | |
| if [[ "$pr_head" != "$EVENT_SHA" || ! "$sha" =~ ^[0-9a-f]{40}$ ]]; then | |
| echo '::error::PR merge revision is unavailable or the PR mirror is stale.' | |
| exit 1 | |
| fi | |
| merge_head=$(gh api "repos/$GITHUB_REPOSITORY/git/commits/$sha" --jq '.parents[1].sha') | |
| if [[ "$merge_head" != "$EVENT_SHA" ]]; then | |
| echo '::error::PR merge revision does not contain the pushed head.' | |
| exit 1 | |
| fi | |
| elif [[ "$EVENT_NAME" == merge_group ]]; then | |
| sha="$MERGE_GROUP_SHA" | |
| fi | |
| if [[ ! "$sha" =~ ^[0-9a-f]{40}$ ]]; then | |
| echo '::error::Expected a full tested commit SHA.' | |
| exit 1 | |
| fi | |
| echo "sha=$sha" >> "$GITHUB_OUTPUT" | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| ref: ${{ steps.revision.outputs.sha }} | |
| fetch-depth: 0 | |
| - name: Classify changes | |
| id: changes | |
| uses: ./.github/actions/classify-changes | |
| with: | |
| base-ref: ${{ needs.pre-flight.outputs.base_ref }} | |
| head-sha: ${{ steps.revision.outputs.sha }} | |
| component_locks: | |
| name: Component locks | |
| needs: [pre-flight, classify_changes] | |
| uses: ./.github/workflows/component-locks.yml | |
| with: | |
| checkout-ref: ${{ needs.classify_changes.outputs.sha }} | |
| unit_tests: | |
| name: Unit tests | |
| needs: [pre-flight, classify_changes] | |
| if: needs.classify_changes.outputs.docs_only != 'true' | |
| uses: ./.github/workflows/unit-tests.yml | |
| with: | |
| checkout-ref: ${{ needs.classify_changes.outputs.sha }} | |
| base-ref: ${{ needs.pre-flight.outputs.base_ref }} | |
| # Conformance is published separately as an optional check. | |
| harness_conformance: | |
| name: Harness conformance (non-blocking) | |
| needs: [pre-flight, classify_changes] | |
| uses: ./.github/workflows/harness-conformance.yml | |
| permissions: | |
| contents: read | |
| actions: read | |
| checks: write | |
| with: | |
| checkout-ref: ${{ needs.classify_changes.outputs.sha }} | |
| # Queue groups and main pushes can contain more than one commit. | |
| # PR mirrors retain the full branch diff against the PR's base branch. | |
| base-ref: ${{ github.event.merge_group.base_sha || (github.ref == 'refs/heads/main' && github.event.before) || needs.pre-flight.outputs.base_ref }} | |
| # Compliance is published separately as an optional check. It is not part of the schedule; | |
| # a manual dispatch of this workflow checks every component. | |
| environment_server_compliance: | |
| name: Environment Server compliance (non-blocking) | |
| needs: [pre-flight, classify_changes] | |
| if: github.event_name != 'schedule' | |
| uses: ./.github/workflows/environment-server-compliance.yml | |
| permissions: | |
| contents: read | |
| actions: read | |
| checks: write | |
| with: | |
| checkout-ref: ${{ needs.classify_changes.outputs.sha }} | |
| base-ref: ${{ github.event.merge_group.base_sha || (github.ref == 'refs/heads/main' && github.event.before) || needs.pre-flight.outputs.base_ref }} | |
| container_build: | |
| name: Build Gym container | |
| needs: [pre-flight, classify_changes, unit_tests] | |
| # Nightly only: this job runs on the internal nemo-ci-aws-gpu-x2 runner | |
| # pool, which is shared with NeMo-RL's H100 CI traffic and was queuing | |
| # indefinitely on every PR push. Run it on the nightly schedule, or | |
| # on-demand via workflow_dispatch, instead. | |
| # | |
| # GitHub applies an implicit success() check before a job's `if:` unless | |
| # the condition contains a status function. Evaluate this condition even | |
| # when docs-only classification legitimately skips unit_tests, while still | |
| # rejecting cancellation or failed dependencies explicitly. | |
| if: >- | |
| ${{ | |
| always() && !cancelled() && | |
| needs.classify_changes.outputs.is_nightly == 'true' && | |
| needs.pre-flight.result == 'success' && | |
| needs.classify_changes.result == 'success' && | |
| (needs.unit_tests.result == 'success' || needs.unit_tests.result == 'skipped') | |
| }} | |
| runs-on: ${{ startsWith(needs.pre-flight.outputs.runner_prefix, 'ephe-v2-') && format('{0}-a{1}', needs.pre-flight.outputs.runner_prefix, github.run_attempt) || needs.pre-flight.outputs.runner_prefix }} | |
| environment: ${{ contains(needs.pre-flight.outputs.registry, 'azure') && 'nemo-ci' || '' }} | |
| outputs: | |
| image: ${{ steps.image.outputs.image }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| ref: ${{ needs.classify_changes.outputs.sha }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | |
| - name: Compute image and cache keys | |
| id: image | |
| shell: bash -e -u -o pipefail {0} | |
| env: | |
| REGISTRY: ${{ needs.pre-flight.outputs.registry }} | |
| run: | | |
| branch_key=$(echo "${GITHUB_REF_NAME}" | tr '/' '-' | tr -cd '[:alnum:]._-') | |
| if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then | |
| cache_key="main" | |
| else | |
| cache_key="$branch_key" | |
| fi | |
| if [[ "$cache_key" != "main" ]] && \ | |
| docker buildx imagetools inspect "$REGISTRY/gym:${cache_key}-buildcache" >/dev/null 2>&1; then | |
| cache_seed="$cache_key" | |
| else | |
| cache_seed="main" | |
| fi | |
| echo "cache-key=$cache_key" >> "$GITHUB_OUTPUT" | |
| echo "cache-seed=$cache_seed" >> "$GITHUB_OUTPUT" | |
| echo "image=$REGISTRY/gym:$GITHUB_SHA" >> "$GITHUB_OUTPUT" | |
| - name: Build and push | |
| uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| build-contexts: nemo-gym=. | |
| target: release | |
| platforms: linux/amd64 | |
| push: true | |
| build-args: | | |
| NEMO_GYM_COMMIT=${{ github.sha }} | |
| NVIDIA_BUILD_ID=${{ github.run_id }} | |
| NVIDIA_BUILD_REF=${{ github.ref }} | |
| NEMO_GYM_PREFETCH_CONFIGS=tests/e2e/gpu_e2e.yaml | |
| cache-from: type=registry,ref=${{ needs.pre-flight.outputs.registry }}/gym:${{ steps.image.outputs.cache-seed }}-buildcache | |
| cache-to: type=registry,ref=${{ needs.pre-flight.outputs.registry }}/gym:${{ steps.image.outputs.cache-key }}-buildcache,mode=max | |
| tags: | | |
| ${{ needs.pre-flight.outputs.registry }}/gym:${{ steps.image.outputs.cache-key }} | |
| ${{ steps.image.outputs.image }} | |
| gpu_e2e_tests: | |
| name: ${{ matrix.name }} | |
| needs: [pre-flight, classify_changes, unit_tests, container_build] | |
| # Nightly only, same reasoning as container_build above. Also requires | |
| # container_build to have actually succeeded - its `image` output is set | |
| # before the "Build and push" step runs, so it can be non-empty even if | |
| # the push itself failed. | |
| if: >- | |
| ${{ | |
| always() && !cancelled() && | |
| needs.classify_changes.outputs.is_nightly == 'true' && | |
| needs.pre-flight.result == 'success' && | |
| needs.classify_changes.result == 'success' && | |
| (needs.unit_tests.result == 'success' || needs.unit_tests.result == 'skipped') && | |
| needs.container_build.result == 'success' | |
| }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: GPU E2E - Qwen vLLM rollout | |
| script: ./tests/e2e/gpu_e2e_test.sh | |
| test_type: gpu | |
| model: Qwen/Qwen2.5-0.5B-Instruct | |
| model_revision: 7ae557604adf67be50417f59c2c2f167def9a775 # pragma: allowlist secret | |
| artifact_name: gpu-e2e-qwen-vllm | |
| runs-on: ${{ startsWith(needs.pre-flight.outputs.runner_prefix, 'ephe-v2-') && format('{0}-a{1}', needs.pre-flight.outputs.runner_prefix, github.run_attempt) || needs.pre-flight.outputs.runner_prefix }} | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| ref: ${{ needs.classify_changes.outputs.sha }} | |
| - name: Run ${{ matrix.name }} | |
| uses: ./.github/actions/test-template | |
| with: | |
| script: ${{ matrix.script }} | |
| test-type: ${{ matrix.test_type }} | |
| container-image: ${{ needs.container_build.outputs.image }} | |
| test-data-path: ${{ needs.pre-flight.outputs.test_data_path }} | |
| model: ${{ matrix.model }} | |
| model-revision: ${{ matrix.model_revision }} | |
| results-path: ${{ runner.temp }}/nemo-gym-gpu-e2e/${{ github.run_id }}-${{ github.run_attempt }}/${{ matrix.artifact_name }} | |
| - name: Upload GPU E2E artifacts | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: ${{ matrix.artifact_name }}-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: ${{ runner.temp }}/nemo-gym-gpu-e2e/${{ github.run_id }}-${{ github.run_attempt }}/${{ matrix.artifact_name }} | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| provider_e2e_tests: | |
| name: ${{ matrix.provider }}-e2e | |
| needs: [classify_changes, unit_tests] | |
| # Nightly only: exercises a live external inference provider (Fireworks). | |
| # Run nightly, or on-demand via workflow_dispatch, instead of on every PR | |
| # push. Only needs [classify_changes, unit_tests] (no pre-flight/ | |
| # container_build dependency), so only those two are checked here. | |
| # TEMPORARILY DISABLED: this live Fireworks smoke test is currently failing. | |
| # Remove the leading `false &&` once the provider is healthy again. | |
| if: >- | |
| ${{ | |
| always() && !cancelled() && | |
| false && | |
| needs.classify_changes.outputs.is_nightly == 'true' && | |
| needs.classify_changes.result == 'success' && | |
| (needs.unit_tests.result == 'success' || needs.unit_tests.result == 'skipped') | |
| }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - provider: fireworks | |
| config: responses_api_models/inference_provider/configs/fireworks.yaml | |
| model: accounts/fireworks/models/gpt-oss-20b | |
| model_api_key_secret_name: FIREWORKS | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | |
| with: | |
| ref: ${{ needs.classify_changes.outputs.sha }} | |
| - name: Install uv | |
| run: | | |
| UV_VERSION="$(sed -n 's/^ARG UV_VERSION=//p' docker/Dockerfile)" | |
| if [[ ! "$UV_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Could not read a valid UV_VERSION from docker/Dockerfile: $UV_VERSION" >&2 | |
| exit 1 | |
| fi | |
| curl -LsSf "https://astral.sh/uv/${UV_VERSION}/install.sh" | sh | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| - name: Run provider E2E - ${{ matrix.provider }} | |
| env: | |
| E2E_DIR: ${{ runner.temp }}/nemo-gym-${{ matrix.provider }}-e2e | |
| E2E_MODEL: ${{ matrix.model }} | |
| E2E_PROVIDER_CONFIG: ${{ matrix.config }} | |
| MODEL_API_KEY: ${{ secrets[matrix.model_api_key_secret_name] }} | |
| run: bash tests/e2e/run_inference_provider_e2e.sh | |
| - name: Upload provider E2E artifacts | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: ${{ matrix.provider }}-e2e-results-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: ${{ runner.temp }}/nemo-gym-${{ matrix.provider }}-e2e/results | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| Nemo_CICD_Test: | |
| needs: [pre-flight, classify_changes, component_locks, unit_tests, container_build, gpu_e2e_tests, provider_e2e_tests] | |
| if: always() && !cancelled() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check test results | |
| shell: bash -e -u -o pipefail {0} | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| IS_NIGHTLY: ${{ needs.classify_changes.outputs.is_nightly }} | |
| CLASSIFY_RESULT: ${{ needs.classify_changes.result }} | |
| DOCS_ONLY: ${{ needs.classify_changes.outputs.docs_only }} | |
| PREFLIGHT_RESULT: ${{ needs.pre-flight.result }} | |
| COMPONENT_LOCKS_RESULT: ${{ needs.component_locks.result }} | |
| UNIT_TEST_RESULT: ${{ needs.unit_tests.result }} | |
| CONTAINER_BUILD_RESULT: ${{ needs.container_build.result }} | |
| GPU_E2E_TEST_RESULT: ${{ needs.gpu_e2e_tests.result }} | |
| PROVIDER_E2E_TEST_RESULT: ${{ needs.provider_e2e_tests.result }} | |
| run: | | |
| echo "Event: $EVENT_NAME" | |
| echo "Pre-flight: $PREFLIGHT_RESULT" | |
| echo "Classify changes: $CLASSIFY_RESULT" | |
| echo "Docs only: $DOCS_ONLY" | |
| echo "Component locks: $COMPONENT_LOCKS_RESULT" | |
| echo "Unit tests: $UNIT_TEST_RESULT" | |
| echo "Container build: $CONTAINER_BUILD_RESULT" | |
| echo "GPU E2E tests: $GPU_E2E_TEST_RESULT" | |
| echo "Provider E2E tests: $PROVIDER_E2E_TEST_RESULT" | |
| if [[ "$PREFLIGHT_RESULT" != "success" ]]; then | |
| echo "Pre-flight did not succeed." | |
| exit 1 | |
| fi | |
| if [[ "$CLASSIFY_RESULT" != "success" ]]; then | |
| echo "Change classification did not succeed." | |
| exit 1 | |
| fi | |
| if [[ "$COMPONENT_LOCKS_RESULT" != "success" ]]; then | |
| echo "Component lock freshness did not succeed." | |
| exit 1 | |
| fi | |
| if [[ "$IS_NIGHTLY" == "true" ]]; then | |
| # Nightly/manual runs always fall through to the nightly-job gate | |
| # below, regardless of docs_only classification - unit_tests may | |
| # legitimately be skipped if the latest commit happens to be | |
| # docs-only, but container_build/gpu_e2e_tests/provider_e2e_tests | |
| # still ran and must be checked either way. | |
| if [[ "$UNIT_TEST_RESULT" != "success" && "$UNIT_TEST_RESULT" != "skipped" ]]; then | |
| echo "Unit tests did not succeed." | |
| exit 1 | |
| fi | |
| # TEMPORARILY allow the disabled Fireworks job to be skipped. | |
| if [[ "$CONTAINER_BUILD_RESULT" != "success" || \ | |
| "$GPU_E2E_TEST_RESULT" != "success" || \ | |
| ( "$PROVIDER_E2E_TEST_RESULT" != "success" && \ | |
| "$PROVIDER_E2E_TEST_RESULT" != "skipped" ) ]]; then | |
| echo "One or more nightly jobs did not succeed." | |
| exit 1 | |
| fi | |
| echo "All required test jobs completed successfully." | |
| exit 0 | |
| fi | |
| if [[ "$DOCS_ONLY" == "true" ]]; then | |
| if [[ "$UNIT_TEST_RESULT" == "skipped" ]]; then | |
| echo "Docs-only change: tests were skipped as expected." | |
| exit 0 | |
| fi | |
| echo "Docs-only change had an unexpected test result." | |
| exit 1 | |
| fi | |
| if [[ "$UNIT_TEST_RESULT" != "success" ]]; then | |
| echo "One or more required test jobs did not succeed." | |
| exit 1 | |
| fi | |
| echo "All required test jobs completed successfully." | |
| exit 0 | |
| notify-failure: | |
| name: Notify test failure | |
| runs-on: ubuntu-latest | |
| needs: [ephemeral-runner-routing, pre-flight, classify_changes, component_locks, unit_tests, container_build, gpu_e2e_tests, provider_e2e_tests, Nemo_CICD_Test] | |
| environment: main | |
| permissions: {} | |
| # Use the event directly: setup outputs are empty when setup fails. | |
| if: >- | |
| ${{ | |
| always() && !cancelled() && failure() && | |
| (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && | |
| (github.event_name != 'workflow_dispatch' || inputs.send_notification) | |
| }} | |
| steps: | |
| # Dispatches on feature branches must not alert the shared channel. | |
| - name: Check ref is main or a release branch | |
| id: ref_check | |
| shell: bash | |
| env: | |
| REF: ${{ github.ref_name }} | |
| run: | | |
| if [[ "$REF" == "main" || "$REF" =~ ^r[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "allowed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "allowed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Notify Gym alerts channel | |
| if: steps.ref_check.outputs.allowed == 'true' | |
| uses: NVIDIA-NeMo/FW-CI-templates/.github/actions/notify-ci-failure@f47f58bcf571d7dee8678e0fc5f6eec7800dadd4 | |
| with: | |
| needs-json: ${{ toJSON(needs) }} | |
| webhook: ${{ secrets.SLACK_TEAM_CHANNEL_WEBHOOK }} | |
| merge-queue-notification: | |
| name: Merge queue notification | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'merge_group' | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Comment on PR with merge queue run URL | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HEAD_REF: ${{ github.event.merge_group.head_ref }} | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| run: | | |
| # Extract the PR number from the merge group head ref | |
| # (format: refs/heads/gh-readonly-queue/main/pr-<number>-<sha>) | |
| PR_NUMBER=$(echo "$HEAD_REF" | sed -n 's/.*\/pr-\([0-9]*\)-.*/\1/p') | |
| if [[ -z "$PR_NUMBER" ]]; then | |
| echo "Could not extract a PR number from merge group head ref: $HEAD_REF" >&2 | |
| exit 1 | |
| fi | |
| gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \ | |
| -f body="🔄 Merge queue validation started! You can track the progress here: $RUN_URL" |