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

Issue: act will parse/evaluate arithmetic context expressions that github wont #526

Closed
dannystaple opened this issue Feb 9, 2021 · 5 comments
Labels
area/workflow Relating to workflow definitions kind/bug Something isn't working needs-work Extra attention is needed stale-exempt Exempt from stale

Comments

@dannystaple
Copy link

Act version

$ act --version
act version 0.2.20

Expected behaviour

The code below, which looks viable, is actually invalid. Run within the genuine github workflow context, it will result in invalid reference and not run the whole workflow file. I would expect act to output the same error for the same line.

Actual behaviour

Act will evaluate this expression to the value. This leads to workflows debugged/developed locally that will not run in github.

Workflow and/or repository

The step definition (minimal reproducible):

name: unreal
jobs:
  reproduce:
    runs-on: ubuntu-latest
    steps:
      - env:
          EXPIRY_TIME: ${{ 3 * 24 * 60 * 60 }}
        run: echo ${EXPIRY_TIME}

Steps to reproduce

Run the above in act (eg act push), it will run, and echo that calculated time.
Commit to github (with the right on definition to function) and it will fail.

@dannystaple dannystaple added the kind/bug Something isn't working label Feb 9, 2021
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the stale label Mar 12, 2021
@mikemonkers
Copy link
Contributor

I also see this very same issue. It would be nice to align with GitHub or indicate whether GitHub have plans to add support?

@github-actions github-actions bot removed the stale label Mar 13, 2021
@jsoref
Copy link
Contributor

jsoref commented Apr 4, 2021

Short of reinventing parsing, I can't imagine a good way of handling this. Under the hood, act creates a JavaScript VM (Otto):
https://github.com/nektos/act/blob/41b03b581c7aec251dhile96e9a5ea27009542a798d4/pkg/runner/expression.go#L34-L37

It then asks the VM to evaluate the expression.

* could appear in strings, or in comments. At least the former should be legal in GHA. Not sure about the latter.

While I can understand getting bitten by this edge 😦, I'd hate to have to try to write a fix for it 😨.

(There are other nearby edges that I do want to fix...)

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2021

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

@github-actions github-actions bot added the stale label May 5, 2021
@catthehacker catthehacker added area/workflow Relating to workflow definitions needs-work Extra attention is needed stale-exempt Exempt from stale and removed stale labels May 11, 2021
@ZauberNerd
Copy link
Contributor

This has been fixed with: #908 and will be released with the next version.
If you want to try it out earlier, use one of the snapshots: https://github.com/nektos/act/actions/runs/1653750680 or install / build from master: https://github.com/nektos/act#go-linuxwindowsmacosany-other-platform-supported-by-go https://github.com/nektos/act#manually-building-from-source

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 needs-work Extra attention is needed stale-exempt Exempt from stale
Projects
None yet
Development

No branches or pull requests

5 participants