Repository-wide environment variables for Actions to use? Or alternate approaches

Hi folks,

I was going to ask this on a Slack or Teams channel but there appears to be none dedicated to Actions developers.

My goal is to make a workflow as extensible/DRY as possible. The GH API is very rich so I have been able to make workflows pretty abstract thus far. However, one of my pain points is that I have to create environment variables for each workflow in a repo that are the exact same. These environment variables are truly repo-specific. If I could put them at the repository level, it would make it so I define these variables ONCE per repository.

Consider the following:

  UTIL_DIRECTORY: .github/util

The container registry, for example, is universal across all workflows in a repo for me.

The closest I see is the Repository Secrets functionality, which is close but not quite. Seems kind of strange to put non-secrets in there.

Put the non-secret environment variables in a file in your repo, and use an action to read those into env variables in your workflow. There are several in the marketplace, for example: JSON to variables · Actions · GitHub Marketplace · GitHub

Also, be care with API calls because you do have rate limits.

Thanks Mickey. I assume there’s no plan to offer environment variables for environments, then- just secrets.

I don’t see anything on the public roadmap for it yet: GitHub public roadmap · GitHub

But GitHub is constantly adding new features to Actions, so never say never.