I have the following env definition for a job in Github Actions:
jobs:
build-test-deploy:
runs-on: ubuntu-latest
env:
FOO : foobar-${{ github.sha }}
BAR : BAZ
However the github.sha remains identical when the same workflow is re-run without any commit in between. I need the FOO to be unique for every run (even if it's technically a re-run), independently of commits.
Two options I'm thinking of:
- either generate a random string
- or get the current unix timestamp
I don't know how to get either of these values in the context of the env: directive. There are some actions available to use within steps but how is it possible to get this kind of unique values right from the env directive instead?