{"id":24976882,"url":"https://github.com/rezigned/setup-env-action","last_synced_at":"2025-03-29T08:24:06.926Z","repository":{"id":158901683,"uuid":"634286051","full_name":"rezigned/setup-env-action","owner":"rezigned","description":"Github Action for setting up environment variables dynamically","archived":false,"fork":false,"pushed_at":"2025-03-25T07:34:19.000Z","size":290,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T08:34:48.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/set-up-environment-variables-action","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rezigned.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["rezigned"],"custom":["https://www.paypal.me/rezigned","https://buymeacoffee.com/rezigned"]}},"created_at":"2023-04-29T16:31:54.000Z","updated_at":"2025-03-25T07:33:59.000Z","dependencies_parsed_at":"2023-05-23T00:15:18.319Z","dependency_job_id":"52bf298e-adab-47b1-81b4-53156db52531","html_url":"https://github.com/rezigned/setup-env-action","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezigned%2Fsetup-env-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezigned%2Fsetup-env-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezigned%2Fsetup-env-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rezigned%2Fsetup-env-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rezigned","download_url":"https://codeload.github.com/rezigned/setup-env-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246158221,"owners_count":20732743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-03T22:59:20.223Z","updated_at":"2025-03-29T08:24:06.907Z","avatar_url":"https://github.com/rezigned.png","language":"TypeScript","readme":"# Setup Environment Variable (dynamically)\n\n\u003cp\u003e\n  \u003ca href=\"https://github.com/rezigned/setup-env-action/actions\"\u003e\u003cimg alt=\"setup-env-action status\" src=\"https://github.com/rezigned/setup-env-action/workflows/build-test/badge.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/rezigned/setup-env-action/actions\"\u003e\u003cimg alt=\"setup-env-action status\" src=\"https://github.com/rezigned/setup-env-action/workflows/CodeQL/badge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis action sets up environment variables by evaluating the values with shell command first.\n\n## Usage\n\n**Basic**:\n\n```yaml\nsteps:\n  - uses: rezigned/setup-env-action@v1\n    with:\n      env: |\n        GIT_SHORT_SHA: $(git rev-parse --short HEAD)\n\n  - run: |\n      echo ${{ env.GIT_SHORT_SHA }}\n```\n**Using variable name at input-level**:\n\n\u003e [!WARNING]\n\u003e Although this works. Github will send a warning message like 'VAR NAME' is not a valid input. This is because Github only allows input names defined in `action.yml`.\n\n```yaml\nsteps:\n  - uses: rezigned/setup-env-action@v1\n    with:\n      GIT_SHORT_SHA: $(git rev-parse --short HEAD)\n```\n\n**Specifying shell**:\n\nThe `sh` shell is used by default. User can speicfy other shell by using `shell` input. For example:\n\n```yaml\n  - uses: rezigned/setup-env-action@v1\n    with:\n      env: |\n        GIT_SHORT_SHA: $(git rev-parse --short HEAD)\n      shell: bash\n```\n\n## Why?\n\nGithub workflow currently [doesn't](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#env) allow user to set `env` value by referring to existing `env`.\n\n\u003e *Variables in the env `map` cannot be defined in terms of other variables in the map.*\n\nFor example, this won't work:\n\n```yml\n...\nenv:\n  DOMAIN: https://example.com\n\nsteps:\n  - name: Check status\n    env:\n      API_URL: ${{ env.DOMAIN }}/api\n```\n\nThe current solution recommended by Github is to add extra step and add variable into `GITHUB_ENV` file.\n\nFor example:\n\n```yml\nsteps:\n  - name: Set up envs\n    run: |\n      echo \"API_URL=$DOMAIN/api\" \u003e\u003e $GITHUB_ENV\n\n  - name: Check status\n    run: |\n      echo $API_URL // https://example.com/api\n```\n","funding_links":["https://github.com/sponsors/rezigned","https://www.paypal.me/rezigned","https://buymeacoffee.com/rezigned"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezigned%2Fsetup-env-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frezigned%2Fsetup-env-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezigned%2Fsetup-env-action/lists"}