Splitting pipeline in multiple yml's and include env var file

I have a long pipeline.yml. I want to split it in multiple yml’s, one for push action, other for pull request merge, other for prerelease, other for release.
And for this I want to share a gloval env var’s file, needed by all the pipelines. Is there any way to include?


Hi @jportasa Thanks for your feedback.
You can try to add the following action in each yaml . This action will get the variables defined in the .env file. Please refer to this simple example for details. Hope it helps.

uses: c-py/action-dotenv-to-setenv@v1
  env-file: .env

Thanks but I need the env vars as global vars in the pipeline, with the solution you say I will have to add your code in each job :frowning:

Hi @jportasa
This action is actually implemented through set-env. Those env variables are available for any actions running next in a job, so it needs to be added in each job as you said.

I recommend that you can report the feature requests here. That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions.

@jportasa did you ever get a solution to this? I also need to share variables across different pipelines.

Morning! no, haven’t got a solution yet. :frowning:

thats disappointing, i raised a ticket. Hopefully get a response soon.

Offical response from GitHub Support below.

Thank you for reaching out to GitHub Support!

While we don’t have a way to share environment variables across workflows yet, if these values aren’t dynamically generated, would using repository secrets be an option?


There are some limitations to note:

As mentioned, this wouldn’t work if the values are dynamically generated – you’d have to input these hardcoded values as secrets before the workflow runs

A workflow can only have up to 100 secrets

A repository can only have 100 secrets

Secrets are limited to 64 KB in size

Again we apologize that we don’t have a direct solution for this at this time.

However, our roadmap is now publicly visible, so we recommend that you keep an eye on the GitHub Blog and roadmap for the latest announcements about new features.

GitHub Support

Thanks, but is not a good solution for me having them in secrets, I need the values visible.
we get in touch this is my profile, maybe we can help each other when we have issues.


Yep same. The workaround/compromise I’m using is to use .env files for my vars with an action to set the environment variables for each job.

The environment file at least has become trivial with the new Environment Files replacement for set-env. You can just do something like:

cat vars.env >> $GITHUB_ENV
1 Like