Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError with variables having dash in their name #315

Closed
ssbarnea opened this issue Jul 23, 2020 · 3 comments
Closed

ReferenceError with variables having dash in their name #315

ssbarnea opened this issue Jul 23, 2020 · 3 comments
Labels

Comments

@ssbarnea
Copy link

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.

@chrispblink
Copy link

chrispblink commented 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

@chrispblink
Copy link

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants