[GH-ISSUE #315] ReferenceError with variables having dash in their name #222

Closed
opened 2026-03-01 21:41:27 +03:00 by kerem · 3 comments
Owner

Originally created by @ssbarnea on GitHub (Jul 23, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/315

level=error msg="Unable to interpolate string 'py${{ matrix.python-version }}@${{ matrix.os }}' - [ReferenceError: 'version' is not defined]"

python-version is defined at matrix level and has special meaning for github so there is no way to change that.

Based on the error, I suspect that the parser is broken as it ends up looking for version.

Originally created by @ssbarnea on GitHub (Jul 23, 2020). Original GitHub issue: https://github.com/nektos/act/issues/315 ``` level=error msg="Unable to interpolate string 'py${{ matrix.python-version }}@${{ matrix.os }}' - [ReferenceError: 'version' is not defined]" ``` `python-version` is defined at matrix level and has special meaning for github so there is no way to change that. Based on the error, I suspect that the parser is broken as it ends up looking for version.
kerem 2026-03-01 21:41:27 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@chrispblink commented on GitHub (Jul 31, 2020):

I'd like to add to this, you can get around this problem by using index syntax (eg matrix["python-version"]) but this is actually invalid syntax and will fail to parse on GitHub Actions. Woops!

Example snippet

      - name: Install kubedog (for log streaming)
        # only install if its not in cache
        if: steps.kubedog_cache.outputs["cache-hit"] == 'false'

The error on GitHub Actions

Invalid workflow file
The workflow is not valid. .github/workflows/issues.yml (Line: 81, Col: 13): Unexpected symbol: '"cache-hit"'. Located at position 29 within expression: steps.kubedog_cache.outputs["cache-hit"] == 'false'

After some quick googling it seems there is a valid index syntax according to the GitHub Actions docs

As part of an expression, you may access context information using one of two syntaxes.

  • Index syntax: github['sha']
  • Property dereference syntax: github.sha
<!-- gh-comment-id:667173922 --> @chrispblink commented on GitHub (Jul 31, 2020): I'd like to add to this, you can get around this problem by using index syntax (eg `matrix["python-version"]`) but this is actually invalid syntax and will fail to parse on GitHub Actions. Woops! Example snippet ``` - name: Install kubedog (for log streaming) # only install if its not in cache if: steps.kubedog_cache.outputs["cache-hit"] == 'false' ``` The error on GitHub Actions > **Invalid workflow file** > `The workflow is not valid. .github/workflows/issues.yml (Line: 81, Col: 13): Unexpected symbol: '"cache-hit"'. Located at position 29 within expression: steps.kubedog_cache.outputs["cache-hit"] == 'false'` After some quick googling it seems there _is_ a valid index syntax according to the [GitHub Actions docs](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts) > As part of an expression, you may access context information using one of two syntaxes. > * Index syntax: `github['sha']` > * Property dereference syntax: `github.sha`
Author
Owner

@chrispblink commented on GitHub (Aug 3, 2020):

Well... some poking around the codebase lead me to the previous discussion of this issue (#104) and the already-implemented fix (#287) in master 😅

<!-- gh-comment-id:668135162 --> @chrispblink commented on GitHub (Aug 3, 2020): Well... some poking around the codebase lead me to the previous discussion of this issue (#104) and the already-implemented fix (#287) in master 😅
Author
Owner

@github-actions[bot] commented on GitHub (Oct 3, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:703012081 --> @github-actions[bot] commented on GitHub (Oct 3, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#222
No description provided.