Codeowners Approval Workflow #694
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
| name: "Codeowners Approval Workflow" | |
| on: | |
| push: | |
| branches: | |
| - "pull-request/[0-9]+" | |
| merge_group: | |
| types: [checks_requested] | |
| jobs: | |
| pre-flight: | |
| uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/[email protected] | |
| if: github.repository == 'NVIDIA/Megatron-LM' | |
| codeowners-approval: | |
| needs: [pre-flight] | |
| runs-on: ubuntu-latest | |
| environment: nemo-ci | |
| if: | | |
| !(needs.pre-flight.outputs.docs_only == 'true' | |
| || needs.pre-flight.outputs.is_merge_group == 'true' | |
| || needs.pre-flight.outputs.is_deployment_workflow == 'true') | |
| steps: | |
| - name: Get PR info | |
| id: get-pr-info | |
| if: startsWith(github.ref, 'refs/heads/pull-request/') | |
| uses: nv-gha-runners/get-pr-info@main | |
| - name: Checkout action | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: noamelf/codeowner-multi-approval-action | |
| ref: v0.1 | |
| path: codeowner-multi-approval-action | |
| - name: Check Codeowners Approval | |
| uses: ./codeowner-multi-approval-action | |
| with: | |
| pr-number: ${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number }} | |
| repo-name: ${{ github.repository }} | |
| github-token: ${{ secrets.PAT }} | |
| multi-approval-bot-summary: | |
| needs: [pre-flight, codeowners-approval] | |
| if: | | |
| ( | |
| needs.pre-flight.outputs.docs_only == 'true' | |
| || needs.pre-flight.outputs.is_merge_group == 'true' | |
| || needs.pre-flight.outputs.is_deployment_workflow == 'true' | |
| || always() | |
| ) | |
| && github.repository == 'NVIDIA/Megatron-LM' | |
| && !cancelled() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Result | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GITHUB_RUN_ID: ${{ github.run_id }} | |
| SKIPPING_IS_ALLOWED: ${{ needs.pre-flight.outputs.docs_only == 'true' || needs.pre-flight.outputs.is_deployment_workflow == 'true' || needs.pre-flight.outputs.is_merge_group == 'true' || needs.pre-flight.outputs.is_ci_workload == 'true' }} | |
| run: | | |
| FAILED_JOBS=$(gh run view $GITHUB_RUN_ID --json jobs --jq '[.jobs[] | select(.status == "completed" and .conclusion != "success")] | length') || echo 0 | |
| if [ "${FAILED_JOBS:-0}" -eq 0 ] || [ "$SKIPPING_IS_ALLOWED" == "true" ]; then | |
| echo "✅ All previous jobs completed successfully" | |
| exit 0 | |
| else | |
| echo "❌ Found $FAILED_JOBS failed job(s)" | |
| # Show which jobs failed | |
| gh run view $GITHUB_RUN_ID --json jobs --jq '.jobs[] | select(.status == "completed" and .conclusion != "success") | .name' | |
| exit 1 | |
| fi |