Expand my Community achievements bar.

How to add env variable in github project for edge delivery services

Avatar

Level 2

Hi,
Facing challenges in adding env variables in edge delivery git project. Can you please suggest a way to add the env variable so that I can use them in blocks folder js?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 4

Hi @skchauhan 

Navigate to Settings > Secrets > Actions
Add your environment variables (secrets) with their corresponding values
These secrets can be accessed in your GitHub Actions workflows
Screenshot 2024-06-20 105007.png

in your .github/workflows directory, create or modify a workflow YAML file (e.g., main.yml)
use the environment variables (secrets) in your workflow steps.

in your JavaScript files (such as in the blocks folder), you can access the environment variables using process.env.VARIABLE_NAME