Skip to content

Access to github actions specific environment variables #231

@end2endzone

Description

@end2endzone

Describe the bug
I am unable to refer to environment variables using the ${{env.name} syntax. More specifically, the environment variable ImageOS that is automatically created by Github when running a workflow.

Version

  • V1
  • V2

Environment

  • self-hosted
  • Linux
  • Windows
  • Mac

Screenshots
Usage:

    - name: Archive installation packages
      uses: actions/upload-artifact@v2
      with:
        name: bin2cpp-packages-${{env.ImageOS}}
        path: build/bin2cpp-${{env.BIN2CPP_VERSION}}-*.*

Output:

Run actions/upload-artifact@v2
  with:
    name: bin2cpp-packages-
    path: build/bin2cpp-2.4.0-*.*
    if-no-files-found: warn
  env:
    PlatformToolset: v140
    Platform: x64
    Configuration: Release
    pythonLocation: C:\hostedtoolcache\windows\Python\3.9.5\x64
    GIT_REPOSITORY: bin2cpp
    GIT_BRANCH: master
    GITHUB_WORKFLOW: Windows
    UNITTEST_REPORT_PATH: D:\a\bin2cpp\bin2cpp\build\bin\Release\bin2cpp_unittest.x64.release.xml
    BIN2CPP_VERSION: 2.4.0

Run/Repo Url
Repo: https://github.com/end2endzone/bin2cpp
Workflow runs: macos, linux and windows

How to reproduce
I call the action as specified above in "usage". Looking at the output, we see that name is resolved as bin2cpp-packages- instead of the expected string bin2cpp-packages-ubuntu20. It is missing the ${{env.ImageOS}} concatenation. I was under the impression that I could refer to any environment variables as specified in your readme here but in your example, name might be a custom variable.

Additional context
Looking at the "usage" reference above, I am able to refer to my "custom" environment variable BIN2CPP_VERSION without a problem. This variable is created manually in a previous step with something like echo BIN2CPP_VERSION=2.4.0 >> $GITHUB_ENV. However, I am unable to reference other environment variables such as the one provided by Github Actions.

I was able to confirm that ImageOS environment is actually created using the following action in Linux and macOS :

    - name: List environment variables for debugging
      working-directory: ${{env.GITHUB_WORKSPACE}}
      shell: bash
      run: |
        env

or on Windows,

    - name: List environment variables for debugging
      working-directory: ${{env.GITHUB_WORKSPACE}}
      shell: cmd
      run: |
        set

Note: This issue seems to be related to #216 but I am not certain thus creating a new issue. #216 is about specific docker variables which I do not use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions