Confused by : ${{ env.OPTIONS }}

I’m trying to learn Github Actions using a repo with a TOC Generator action.

It’s uses a set of Options:

          GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
          TARGET_BRANCH_PREFIX: ${{ env.BRANCH_PREFIX }}
          FOLDING: ${{ env.TOC_FOLDING }}
          MAX_HEADER_LEVEL: ${{ env.TOC_MAX_HEADER_LEVEL }}
          TOC_TITLE: ${{ env.TOC_TITLE }}
          CREATE_PR: ${{ env.TOC_CREATE_PR }}
          TARGET_PATHS: ${{ env.TOC_TARGET_PATHS }}

Those Options are explained in the toc-generator documentation; but where and how do i define or supply the env.VALUES?! (myrepo/settings/environments?)

Also the action documentation though extensive doesn’t explain this to me!

Any help would be appreciated.

The env context refers to environment variables. You can set them in the workflow file, or dynamically by writing to a special file. For details, see:

Tnx

setting directly in workflow.yml makes more sense to me "

TOC_TITLE: ${{ env.TOC_TITLE }} -> TOC_TITLE: “My TOC Title”

But ‘writing to a special file’ doesn’t make sense to me; even after reading the linked GitHub Doc.

I know I can set secrets and environment options on each repo, but I’m not sure where env.TOC_TITLE should point to!?

for instance when I look at :

I see many ${{ env.somestyff) references and I’m trying to understand where to put those values!

You only need that if you want to generate a value dynamically while your workflow is running. In that case see Setting an environment variable.

Otherwise you should be able to just use static values like this:

      - uses: technote-space/toc-generator@gh-actions
        with:
          TOC_TITLE: 'your title here'
          # ... other options

In the example you linked it looks like the technote-space/load-config-action creates the environment variables.

1 Like

I’m a bit new to this but i’m starting to see it.
The values are derived from workflow-settings.json / workflow-details.json inside this folder.

I found an interesting series about GitHub Actions including the env part on Dev.to to get me started.

Tnx again for your help!

1 Like