Skip to content

[TASK] Simplify ci.yml workflow dispatcher - #707

Open
ohader wants to merge 2 commits into
TYPO3:mainfrom
ohader:actions
Open

ohader wants to merge 2 commits into
TYPO3:mainfrom
ohader:actions

Conversation

@ohader

@ohader ohader commented Mar 4, 2026

Copy link
Copy Markdown
Member
  • omits having to use GH_TOKEN environment
  • omits having to invoke the gh CLI

- omits having to use GH_TOKEN environment
- omits having to invoke the `gh` CLI
@ohader

ohader commented Mar 4, 2026

Copy link
Copy Markdown
Member Author

ℹ️ Please back-port to other relevant branches as well

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yml and nightly-8.yml to call ./.github/workflows/ci.yml directly via uses:.
  • Makes ci.yml reusable by adding workflow_call + an optional ref input.
  • Updates the CI checkout step to use the provided ref input.

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-main previously always ran CI against the main branch (explicit checkout + --ref main). Now the reusable workflow is invoked without ref, so a manual run from another branch would test that branch instead of main. If the intent is to always validate main, pass with: ref: 'main' (or hardcode the checkout ref in ci.yml when 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.

Comment thread .github/workflows/ci.yml
Comment on lines +27 to +30
- name: Checkout ${{ inputs.ref || '' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.head_ref || '' }}
ref: ${{ inputs.ref || '' }}

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue as far as I can measure: the pull_request CI run on this branch (run 22667295794) evaluated ${{ inputs.ref || '' }} and passed 4/4. The contexts docs describe inputs as available only in reusable or workflow_dispatch workflows, which leaves it empty elsewhere rather than failing. The suggested github.event.inputs.ref would break the nightly: in a called workflow the github context belongs to the caller (docs), so it would be empty for the schedule and nightly-8 would check out main.

Comment on lines +11 to +13
uses: ./.github/workflows/ci.yml
with:
ref: '8'

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Why was the 8 branch test triggered from main before?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Why was the 8 branch test triggered from main before?

SHORT: GH only supports scheduled workflows on the main branch.

LONG:

GH does support scheduled actions only on the main branch and the only way I found was to dispatch the workflow for the 8 branch that whay, but that needs the permission.

To be correct - dispatch the workflow using the workflow definition from that branch and not from 8.

uses: owner/repo/.github/workflows/ci.yml@8

That may work but needs to be verified that it works using the ci.yaml from branch 8 and not main. I was not aware of that branch ref syntax.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirming the concern with numbers, and on the @8 idea:

  • With ./ the called file comes from the caller's commit, i.e. main (docs). Branch 8 would lose its PHP 8.1 cell (main: 8.2-8.5, branch 8: 8.1-8.5, php: ^8.1), and that is exactly the cell failing every night since 2026-10-16.
  • TYPO3/testing-framework/.github/workflows/ci.yml@8 would use branch 8's file, but only works if ci.yml on 8 gets on: workflow_call (it currently has push, pull_request, workflow_dispatch).
  • It still needs with: ref: '8' and the inputs.ref checkout on that branch: in a called workflow the github context is the caller's (docs), so a checkout without ref would fetch main.

I have not run the @8 variant; it would need one manual dispatch to confirm which SHA and matrix end up running.

@CybotTM CybotTM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: for main this is equivalent to today, but for branch 8 the nightly would run main's ci.yml and stop testing PHP 8.1, which is the cell that currently fails every night. The PR also conflicts with main in all three files.

  1. Branch 8 loses PHP 8.1. uses: ./.github/workflows/ci.yml loads the called workflow "from the same commit as the caller workflow" (docs), and scheduled workflows "run on the latest commit on the default branch" (docs). So branch 8 would be tested with main's matrix 8.2-8.5 and main's step conditions instead of its own 8.1-8.5 (composer.json there: php: ^8.1). CGL would move from 8.1 to 8.2/8.3, phpstan from 8.2-8.5 to 8.2/8.3. The dispatched CI on 8 has failed every night since 2026-10-16: only all tests (8.1) fails at "Composer install" (typo3/cms-core 12.x blocked by security advisories on enshrined/svg-sanitize), fail-fast cancels the rest. With this PR the nightly would turn green without that being fixed.
  2. Rebase needed. Conflicts in ci.yml, nightly-8.yml and nightly-main.yml against current main. Resolving ci.yml towards this branch would drop main's actions/checkout@v6, ubuntu-24.04 and the -b docker change from b0814df; only the workflow_call/permissions hunk and the checkout ref hunk need to be carried over.
  3. nightly-9.yml is not covered. It was added on main after this branch (a7a71dc) and still uses the gh dispatcher.
  4. Please run the new path once before merging (manual dispatch of the nightly workflows on this branch). The only run on this head is the pull_request CI run; the workflow_call path has never run.

Options for 8 and 9: keep the gh workflow run dispatcher there, which works today, or add workflow_call with a ref input to ci.yml on 8 and 9 and call TYPO3/testing-framework/.github/workflows/ci.yml@8 with ref: '8' (details in the thread on nightly-8.yml).

Checked and fine
  • main nightly: same workflow file and code as today.
  • push, pull_request, workflow_dispatch runs of ci.yml: the old checkout expression was always '' (github.head_ref is only set for pull request events), the new inputs.ref is '' as well; the pull_request run on this head passed 4/4.
  • Dropping actions: write and GH_TOKEN and adding permissions: contents: read: no step needs more than read.
  • The nightly run now carries the test result itself; today the dispatcher stays green while CI on 8 is red.
  • Nit: nightly-main.yml has no newline at end of file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants