Act: Support for $GITHUB_ENV

Created on 7 Oct 2020  路  11Comments  路  Source: nektos/act

Good day,
First, thank you for writing this tool - AFAIK it's the only local simulator for any CI out there.

To the topic - GH seem to have moved to a new way to define env vars [1]:

echo "action_state=yellow" >> $GITHUB_ENV

However it doesn't seem to be supported by act. Specifying the following in the workflow file:

- name: Set CI instance ID                                                                                               
  run: |                                                                                                                 
    echo GITHUB_ENV=$GITHUB_ENV                                                                                          
    echo 'CI_INSTANCE_ID="-ci${{ github.run_id }}"' >> $GITHUB_ENV  

fails with:

| GITHUB_ENV=
| /github/workflow/1: line 3: $GITHUB_ENV: ambiguous redirect

Can you please support it?

[1] https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable

Most helpful comment

I've gave this a go yesterday, not completely done yet though.
I'll report back when I get it working.

All 11 comments

Using the set-env command also results in a deprecation warning:

The `set-env` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

Thank you very much for this great tool! This issue also applies to the add-path command (e.g. via echo ::add-path).

Another common use is writing to $GITHUB_PATH. i.e. echo "$(composer config -g home)/vendor/bin" >> $GITHUB_PATH so the path persists in subsequent run steps. $GITHUB_PATH would be a file that would get parsed for paths on every run command. I remember doing something like this manually with travisci a while back so it would be really nice to have this working.

Any updates on this?

I've gave this a go yesterday, not completely done yet though.
I'll report back when I get it working.

set-env & friends commands are now disabled by default, i.e. warnings became errors.
Now need to set ACTIONS_ALLOW_UNSECURE_COMMANDS to make it still work.

@haizaar I'll see if I manage to wrap up my PR on this today

I have something working now. Just have to do some clean up and testing tomorrow

@torbjornvatn If you have a build to test, let me know.

Any updates here?

426 is being reviewed by @cplee

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jclem picture jclem  路  6Comments

kochetkovIT picture kochetkovIT  路  4Comments

HoughIO picture HoughIO  路  4Comments

helaili picture helaili  路  4Comments

Applelo picture Applelo  路  5Comments