Skip to content

ci: Apply matrix env vars in the workflow, not in custom actions - #95

Merged
krlmlr merged 1 commit into
mainfrom
claude/gha-env-var-setup-ej3a28
Jul 27, 2026
Merged

ci: Apply matrix env vars in the workflow, not in custom actions#95
krlmlr merged 1 commit into
mainfrom
claude/gha-env-var-setup-ej3a28

Conversation

@krlmlr

@krlmlr krlmlr commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Problem

Matrix entries in .github/versions-matrix.R can carry a generic env field
(one KEY=VALUE per line).
Until now, the rcc-full job only forwarded that field
to the custom before-install action as an input:

- uses: ./.github/workflows/custom/before-install
  with:
    env: ${{ matrix.env }}

Because composite actions cannot read the matrix context,
every consumer repo had to implement the same apply-to-$GITHUB_ENV boilerplate
in its own .github/workflows/custom/before-install/action.yml
(dm, duckdb-r, and rigraph each carry an identical copy today),
and a repo without that boilerplate silently drops the variables.

The claim that surfaced in igraph/rigraph —
"a before-install action is needed to pick up the environment variable" —
was therefore true for all consumer repos, not just rigraph.
It is an artifact of the template design, not of that repo.

CI logs confirm the failure mode for matrix values
referenced directly inside composite actions:
in cynkra/dm's "SQL Server with covr" job,
DM_TEST_SRC (set from ${{ matrix.config.test-src }} inside the composite action)
comes out empty, while the forwarded-input route (DM_VALIDATE=true) works.

Fix

  • Apply the env field directly in the rcc-full job,
    before the custom before-install action runs,
    so the variables reach every subsequent step —
    including the custom before-install and after-install actions —
    in all repos, with no custom amendments needed.
  • Drop the now-redundant env input forwarding.
  • Escape backslash, double quote, and newline
    in the JSON emitted by versions-matrix/action.R,
    so multi-line env values (one KEY=VALUE per line)
    survive the trip through the matrix JSON.

Companion PRs

🤖 Generated with Claude Code

https://claude.ai/code/session_0136C9bRMjBGkUrtLdkYNmAg

Matrix entries in .github/versions-matrix.R can carry a generic "env" field
(one KEY=VALUE per line).
Until now, the rcc-full job only forwarded that field
to the custom before-install action as an input,
so every repo had to implement the same apply-to-GITHUB_ENV boilerplate
in its own .github/workflows/custom/before-install/action.yml —
and repos without that boilerplate silently dropped the variables,
because composite actions cannot read the matrix context.

Apply the "env" field directly in the rcc-full job instead,
before the custom before-install action runs,
so the variables reach every subsequent step in all repos
without any custom amendments.
Drop the now-redundant input forwarding.

Also escape backslash, double quote, and newline
in the JSON emitted by versions-matrix/action.R,
so multi-line "env" values (one KEY=VALUE per line)
survive the trip through the matrix JSON.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants