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

'toJson' is not defined #115

Closed
Nuru opened this issue Feb 28, 2020 · 3 comments
Closed

'toJson' is not defined #115

Nuru opened this issue Feb 28, 2020 · 3 comments
Labels
area/workflow Relating to workflow definitions kind/bug Something isn't working

Comments

@Nuru
Copy link

Nuru commented Feb 28, 2020

One example job in the GitHub Actions documentation uses toJson and it works when run on GitHub, but not when run by act.

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"

runs fine on GitHub, but act complains:

[test/test] ⭐  Run Dump GitHub context
ERRO[0001] Unable to interpolate string '${{ toJson(github) }}' - [ReferenceError: 'toJson' is not defined] 
| ${{ toJson(github) }}
@cplee cplee added area/workflow Relating to workflow definitions kind/bug Something isn't working labels Feb 28, 2020
@cplee
Copy link
Contributor

cplee commented Feb 28, 2020

Looks like i was confused by the docs since the example they provided had:

toJSON(job) might return { "status": "Success" }

Should be a quick fix here: https://github.com/nektos/act/blob/master/pkg/runner/expression.go#L169

@Nuru
Copy link
Author

Nuru commented Feb 28, 2020

@cplee It probably changed during development. I suggest you support both toJSON and toJson. Thanks for the quick turnaround!

cplee added a commit that referenced this issue Feb 28, 2020
@cplee cplee closed this as completed in e9de6ca Feb 28, 2020
@cplee
Copy link
Contributor

cplee commented Feb 28, 2020

Will be included in next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/workflow Relating to workflow definitions kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants