Driver launcher hooks mlflow #24
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
| # This workflow checks if all CI checks have passed by polling every 5 minutes. | |
| # It also records whether the triggering run actually completed that poll, | |
| # so downstream label automation can distinguish real passes from no-op successes. | |
| name: CI Check | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| jobs: | |
| check_ci_status: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| checks: read | |
| steps: | |
| - name: Determine whether CI polling is needed | |
| id: eligibility | |
| shell: bash | |
| run: | | |
| should_poll=false | |
| reason="CI polling is not needed for this pull request event." | |
| if [[ "${{ contains(github.event.pull_request.labels.*.name, 'ok-to-test') }}" != "true" ]]; then | |
| reason="PR is not yet labeled ok-to-test." | |
| elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'needs-ok-to-test') }}" == "true" ]]; then | |
| reason="PR still has the needs-ok-to-test label." | |
| elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" != "ok-to-test" ]]; then | |
| reason="Added label '${{ github.event.label.name }}' does not change CI eligibility." | |
| elif [[ "${{ github.event.action }}" == "unlabeled" && "${{ github.event.label.name }}" != "needs-ok-to-test" ]]; then | |
| reason="Removed label '${{ github.event.label.name }}' does not change CI eligibility." | |
| else | |
| should_poll=true | |
| reason="PR is eligible; running CI status polling." | |
| fi | |
| echo "should_poll=${should_poll}" >> "$GITHUB_OUTPUT" | |
| echo "reason=${reason}" >> "$GITHUB_OUTPUT" | |
| echo "${reason}" | |
| - name: Check if all CI checks passed | |
| id: poll | |
| if: steps.eligibility.outputs.should_poll == 'true' | |
| uses: wechuli/allcheckspassed@0b68b3b7d92e595bcbdea0c860d05605720cf479 | |
| with: | |
| delay: '5' | |
| retries: '10' | |
| polling_interval: '5' | |
| # Exclude checks dynamically created by the GitHub Copilot pull request reviewer. | |
| # These checks fail with HTTP 403 on fork PRs due to permission limitations, | |
| # causing false negatives in the status gate. If the Copilot reviewer adds or | |
| # renames checks, update this list accordingly. | |
| checks_exclude: '^Cleanup artifacts$,^Upload results$,^Agent$,^Prepare$' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Skip CI polling with success | |
| if: steps.eligibility.outputs.should_poll != 'true' | |
| run: echo "${{ steps.eligibility.outputs.reason }}" | |
| - name: Record CI check result | |
| if: always() | |
| shell: bash | |
| run: | | |
| mkdir -p ci-check-result | |
| should_poll="${{ steps.eligibility.outputs.should_poll }}" | |
| poll_outcome="${{ steps.poll.outcome }}" | |
| should_add_label=false | |
| if [[ -z "${should_poll}" ]]; then | |
| should_poll=false | |
| fi | |
| if [[ -z "${poll_outcome}" ]]; then | |
| poll_outcome=skipped | |
| fi | |
| if [[ "${should_poll}" == "true" && "${poll_outcome}" == "success" ]]; then | |
| should_add_label=true | |
| fi | |
| jq -n \ | |
| --arg pr_number "${{ github.event.pull_request.number }}" \ | |
| --arg head_sha "${{ github.event.pull_request.head.sha }}" \ | |
| --arg poll_outcome "${poll_outcome}" \ | |
| --argjson should_poll "${should_poll}" \ | |
| --argjson should_add_label "${should_add_label}" \ | |
| '{ | |
| pr_number: $pr_number, | |
| head_sha: $head_sha, | |
| should_poll: $should_poll, | |
| poll_outcome: $poll_outcome, | |
| should_add_label: $should_add_label | |
| }' > ci-check-result/result.json | |
| - name: Upload CI check result | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ci-check-result | |
| path: ci-check-result/result.json | |
| if-no-files-found: error |