Skip to content

Explicitly guard optional matrix steps in CI workflow#89

Merged
JohannesLorenz merged 3 commits intomingwfrom
copilot/sub-pr-88
Mar 16, 2026
Merged

Explicitly guard optional matrix steps in CI workflow#89
JohannesLorenz merged 3 commits intomingwfrom
copilot/sub-pr-88

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

Steps using optional matrix fields (update, deps1, deps2) relied on GitHub Actions silently no-oping an empty run value — undocumented behavior that works today but is fragile.

Changes

  • .github/workflows/ccpp.yml: Added && matrix.config.<field> != '' to the if conditions for update system, install deps (1), and install deps (2) steps, so they are skipped when the field is absent rather than running an empty command.
- name: update system
  if: ${{ matrix.config.enabled == 1 && matrix.config.update != '' }}
  run: ${{ matrix.config.update }}
- name: install deps (2)
  if: ${{ matrix.config.enabled == 1 && matrix.config.deps2 != '' }}
  run: ${{ matrix.config.deps2 }}

Only the MinGW matrix entry defines update and deps2; all other entries omit them and will now cleanly skip those steps.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: JohannesLorenz <1042576+JohannesLorenz@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on MinGW addition to CI setup Explicitly guard optional matrix steps in CI workflow Mar 16, 2026
Copilot AI requested a review from JohannesLorenz March 16, 2026 19:49
@JohannesLorenz
Copy link
Copy Markdown
Collaborator

@copilot you test only against empty strings. Will your solution also work if the matrix entry does not exist?

Co-authored-by: JohannesLorenz <1042576+JohannesLorenz@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 16, 2026

@copilot you test only against empty strings. Will your solution also work if the matrix entry does not exist?

Yes — in GitHub Actions expressions, accessing an undefined context property returns an empty string, which is falsy. So both != '' and a truthy check handle the absent-field case.

That said, I've switched to the plain truthy form (matrix.config.update, matrix.config.deps1, matrix.config.deps2) in commit bd548d2, which makes the intent clearer and is idiomatic for optional fields — it works correctly whether the field is absent from the matrix entry or explicitly set to an empty string.

@JohannesLorenz JohannesLorenz marked this pull request as ready for review March 16, 2026 21:26
@JohannesLorenz JohannesLorenz merged commit 7c27294 into mingw Mar 16, 2026
6 checks passed
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.

2 participants