Default contexts are empty even though default envars are populated

Hi,

My yaml file looks like this:

name: create runner-test
on: [workflow_dispatch]
env:
TF_VAR_GITHUB_REPOSITORY: ${{ github.repository }}
TF_VAR_GITHUB_SERVER_URL: ${{ github.server.url }}
TF_VAR_GITHUB_WORKFLOW: ${{ github.workflow }}
TF_VAR_GITHUB_RUN_NUMBER: ${{ github.run.number }}

In my workflow logs I see only two of the custom envars getting populated:

TF_VAR_GITHUB_REPOSITORY: [redacted]
TF_VAR_GITHUB_SERVER_URL:
TF_VAR_GITHUB_WORKFLOW: create runner-test
TF_VAR_GITHUB_RUN_NUMBER:

However the actual GITHUB_* envars are all populated (see the two below are populated, but the ones above were not).

GITHUB_SERVER_URL=https://github.com
GITHUB_RUN_NUMBER=21

It looks like the contexts are not getting populated in the first place.

Anyone see a similar issue. Or know where to post this issue?

Thanks.

Hey do you have this file in a public repo where I could take a look at it? All of that information should be in the github context object, so your env variables should have been populated. I’d like to see your full workflow file.

Hi,

I setup the above. Only two of the three variables get populated. My log looks like:

env
shell: /usr/bin/bash -e {0}
env:
TF_VAR_GITHUB_REPOSITORY: scott-doyland-burrows/github-actions-test
TF_VAR_GITHUB_WORKFLOW: myrunner
TF_VAR_GITHUB_SERVER_URL:

Thanks,
Scott

You have the server URL variable declared incorrectly in your YML file. It should be: ${{ github.server_url }}

Here is an example workflow run that outputs the github context variable. It is a good way to see what is available in the context, and how it is named.

Hi,

Thanks. I notcied this myself and came here to update my post, and you had already spotted my mistake.

Thanks very much. The _ and . were confusing me.

Scott