In GitHub Actions i'd like to evaluate a bash expression and then assign it to an environment variable -
- name: Tag image
env:
GITHUB_SHA_SHORT: ${{ $(echo $GITHUB_SHA | cut -c 1-6) }}
..do other things...
However this naive attempt has failed. According to the docs this doesn't seem to be supported however a somewhat clean workaround would be fine.
Using
set-env
in a previous step works for me.(From https://help.github.com/en/articles/development-tools-for-github-actions#set-an-environment-variable-set-env)
This is an alternative way to reference the environment variable in workflows.