Can I rewrite the other Doppler secrets file to GITHUB_ENV?

Hello, there is a problem importing the Doppler secret from Github Actions.

stage doppler to GITHUB_ENV → stage process → overwrite master doppler to GITHUB_ENV → stage ← data import (master DB) → Done

I want to create this process, but I don’t think I can get another Doppler file because GITHUB_ENV already contains DOPPLER_TOKEN. Is there a way to solve this problem?

Hi @jieey1140!

Probably the easiest way to accomplish what you’re after here is to use our GitHub Action for fetching the secrets:

This allows you to specify a Doppler token to fetch the secrets with and allows you to have it inject the variables into the environment:

name: Doppler secrets from environment variables

on: [push]

jobs:
  secrets-fetch:
    runs-on: ubuntu-latest
    steps:
    - uses: dopplerhq/secrets-fetch-action@v1.1.0
      id: doppler
      with:
        doppler-token: ${{ secrets.DOPPLER_TOKEN }}
        inject-env-vars: true
    - run: printenv

In your case, if you have multiple tokens you’d like to use, you would need to set them to environment variables with different names. For example, you might have BACKEND_DOPPLER_TOKEN and STAGE_DOPPLER_TOKEN. You would then specify which one you want to use when the action executes.

Does that solve what you’re after? If not, could you elaborate a bit more on what you’re trying to do?

Regards,
-Joel

1 Like

Hello, it took some time to check and use. We solved it perfectly with the solution you helped. Thank you!! :slight_smile:

1 Like

No problem! Have a great week! :smiley:

2 Likes