Skip to content

[Code scan] Pass matrix.basis into the interface workflow heredoc #7571

Description

@njzjz

This issue is a result of a Codex global repository scan.

The manual interface GitHub Actions workflow defines basis in the matrix, but the Python heredoc in the “Create mock data & patch script” step references basis without defining it or passing it through the environment. The workflow can therefore fail with NameError: name 'basis' is not defined before mock data is generated.

Matrix entries:

matrix:
include:
- name: basic (LCAO)
script: example_basic.py
prefix: Bi2Se3_basic
basis: lcao
- name: pw (Plane Wave)
script: example_pw.py
prefix: Bi2Se3_pw
basis: pw
- name: advance (LCAO)
script: example_advance.py
prefix: Bi2Se3_advanced
basis: lcao

Environment and Python heredoc:

- name: Create mock data & patch script
env:
SCRIPT: ${{ matrix.script }}
PREFIX: ${{ matrix.prefix }}
run: |
python3 << 'PYEOF'
import os, re, textwrap
script = os.environ["SCRIPT"]
prefix = os.environ["PREFIX"]

Undefined reference:

# ── 3. Mock STRU (scf/ + wannier/) ────────────────────
if basis == "pw":
atom_species = (
"ATOMIC_SPECIES\n"
"Bi 208.980 Bi_pbe_fr.upf\n"
"Se 78.960 Bi_pbe_fr.upf\n"
"\n"
)
else:
atom_species = (

Relevant code:

env:
  SCRIPT: ${{ matrix.script }}
  PREFIX: ${{ matrix.prefix }}
run: |
  python3 << 'PYEOF'
  import os, re, textwrap

  script = os.environ["SCRIPT"]
  prefix = os.environ["PREFIX"]
  ...
  if basis == "pw":

Suggested fix:

Add BASIS: ${{ matrix.basis }} to the step environment and read basis = os.environ["BASIS"] inside the heredoc.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions