[TASK] Simplify ci.yml workflow dispatcher#707
Conversation
- omits having to use GH_TOKEN environment - omits having to invoke the `gh` CLI
|
ℹ️ Please back-port to other relevant branches as well |
There was a problem hiding this comment.
Pull request overview
This PR simplifies the nightly dispatcher workflows by switching from gh workflow run ... (and GH_TOKEN) to invoking the existing CI workflow as a reusable workflow.
Changes:
- Refactors
nightly-main.ymlandnightly-8.ymlto call./.github/workflows/ci.ymldirectly viauses:. - Makes
ci.ymlreusable by addingworkflow_call+ an optionalrefinput. - Updates the CI checkout step to use the provided
refinput.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/nightly-main.yml | Switches nightly main dispatch to a reusable workflow call. |
| .github/workflows/nightly-8.yml | Switches nightly 8 dispatch to a reusable workflow call with ref: '8'. |
| .github/workflows/ci.yml | Adds workflow_call support and uses a ref input for checkout. |
Comments suppressed due to low confidence (1)
.github/workflows/nightly-main.yml:12
nightly-mainpreviously always ran CI against themainbranch (explicit checkout +--ref main). Now the reusable workflow is invoked withoutref, so a manual run from another branch would test that branch instead ofmain. If the intent is to always validatemain, passwith: ref: 'main'(or hardcode the checkout ref inci.ymlwhen called from this workflow).
name: "dispatch-nightly-main"
uses: ./.github/workflows/ci.yml
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| - name: Checkout ${{ inputs.ref || '' }} | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event_name == 'workflow_dispatch' && github.head_ref || '' }} | ||
| ref: ${{ inputs.ref || '' }} |
There was a problem hiding this comment.
inputs.ref is referenced unconditionally, but the inputs context is only populated for workflow_call / workflow_dispatch runs. Since this workflow still runs on push and pull_request, those events may fail at expression evaluation with an unrecognized context. Use github.event.inputs.ref (which safely resolves to empty when not present) or switch to a fallback like github.sha/github.ref without referencing inputs for non-call runs.
| uses: ./.github/workflows/ci.yml | ||
| with: | ||
| ref: '8' |
There was a problem hiding this comment.
Behavior change vs the previous gh workflow run ci.yml --ref 8: this now runs the current branch's ci.yml definition (via local uses: ./.github/workflows/ci.yml) while checking out code from ref: '8'. If branch 8 expects a different CI workflow version, this will no longer match; consider calling a workflow from 8 (e.g., using uses: owner/repo/.github/workflows/ci.yml@8) or explicitly confirming that CI should be driven from main for the 8 branch.
There was a problem hiding this comment.
Good question. Why was the 8 branch test triggered from main before?
ghCLI