Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can you set worker secret for a specific environment? #251

Open
tien opened this issue Apr 9, 2024 · 5 comments
Open

How can you set worker secret for a specific environment? #251

tien opened this issue Apr 9, 2024 · 5 comments

Comments

@tien
Copy link

tien commented Apr 9, 2024

- uses: cloudflare/wrangler-action@v3
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    command: deploy --env production
    secrets: |
      SUPER_SECRET
  env:
    SUPER_SECRET: ${{ secrets.SUPER_SECRET }}

Assuming the worker name is my-worker doing the above would create 2 workers: my-worker & my-worker-production with the secrets only set for my-worker.

@renzor-fist
Copy link

+1, encountering the same issue. Using --env production deploys two workers (worker and worker-production and sets secrets on worker instead of worker-production.

@tien
Copy link
Author

tien commented Apr 16, 2024

From looking at the source code, I found out that there's actually an environment parameter that you can pass to the action. This needs to be documented.

@renzor-fist
Copy link

Thanks @tien can you provide an example?

@renzor-fist
Copy link

I see what you are referring to, thank you.

https://github.com/cloudflare/wrangler-action/blob/main/src/index.ts#L28

@Codex-
Copy link

Codex- commented Sep 4, 2024

From looking at the source code, I found out that there's actually an environment parameter that you can pass to the action. This needs to be documented.

This saved me a lot of pain, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants