We are trying to setup our CI so that we get the Github Ref into our code.
We've tried the following in our Workflow file:
- run: GITHUB_REF="${GITHUB_REF}" CI=true yarn test:pact:consumer
But it doesn't do much:
We've tried the following also:
GITHUB_REF="$GITHUB_REF" CI=true yarn test:pact:consumer
CodePudding user response:
I've tried the following two, and in both cases the value seems to be passed to script.
- In github action yaml
- run: GITHUB_REF="${GITHUB_REF}" CI=true yarn foo
- run: GITHUB_REF=${{ github.ref }} CI=true yarn foo
foo.js
console.log('process.env.GITHUB_REF: ', process.env.GITHUB_REF)
- In
package.json
"scripts": {
"foo": "node foo.js"
}
- result