{"id":15174036,"url":"https://github.com/gbh-tech/set-environment-action","last_synced_at":"2026-01-04T19:04:00.728Z","repository":{"id":226299273,"uuid":"768302222","full_name":"gbh-tech/set-environment-action","owner":"gbh-tech","description":"Outputs an environment variable by the key 'ENVIRONMENT' based on the triggering GitHub event. and git ref name.","archived":false,"fork":false,"pushed_at":"2024-05-24T20:55:10.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T18:34:29.013Z","etag":null,"topics":["action","environment","github","set","utility"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/gbh-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-06T20:49:54.000Z","updated_at":"2024-05-24T20:55:13.000Z","dependencies_parsed_at":"2024-10-11T03:00:58.163Z","dependency_job_id":"36425b6d-14e2-4409-aa17-d8ac77a42a25","html_url":"https://github.com/gbh-tech/set-environment-action","commit_stats":null,"previous_names":["gbh-tech/set-environment-action"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbh-tech%2Fset-environment-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbh-tech%2Fset-environment-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbh-tech%2Fset-environment-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbh-tech%2Fset-environment-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gbh-tech","download_url":"https://codeload.github.com/gbh-tech/set-environment-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244886886,"owners_count":20526507,"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":["action","environment","github","set","utility"],"created_at":"2024-09-27T11:23:17.687Z","updated_at":"2026-01-04T19:04:00.650Z","avatar_url":"https://github.com/gbh-tech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- omit in toc --\u003e\n# Set Environment Action\n\n\u003c!-- omit in toc --\u003e\n## Content\n\n- [Overview](#overview)\n- [Environments](#environments)\n- [Environment mapping](#environment-mapping)\n- [Usage](#usage)\n  - [Examples](#examples)\n\n## Overview\n\nThis GitHub Action facilitates setting the environment name based on the\ntriggering workflow and git ref.\n\n\u003e ⚠️ This action is tailored for our specific needs and development workflow,\n\u003e at this moment, you cannot change the triggering events or the environment\n\u003e tag. Only use if you can adapt it on your workflow!\n\nThe action exposes the environment name value in two different contexts:\n\n- Outputs\n- [env context]\n\n## Environments\n\nThis action can output the following environment names:\n\n- `stage`\n- `uat`\n- `production`\n\n## Environment mapping\n\nThe environment name mapping is as follows:\n\n- Push event on a branch with name `main` -\u003e Outputs environment **stage**.\n- Tag push matching `v[0-9].[0-9].[0-9]-uat.[0-9]` -\u003e Outputs **uat**.\n- Tag matching `v[0-9].[0-9].[0-9]` -\u003e Outputs **production**.\n\nThe Action uses `github.ref_name` to determine the branch or tag name.\n\n## Usage\n\nSee [action.yml](action.yml) for more info about the action.\n\n```yaml\n- uses: gbh-tech/set-environment-action@v0.1.1\n  id: env\n```\n\n### Examples\n\n```yaml\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: gbh-tech/set-environment-action@v0.1.1\n        id: env\n\n      # Using outputs\n      - name: Show the selected environment name using output\n        env:\n          ENVIRONMENT: ${{ steps.env.outputs.environment }}\n        run: echo \"Environment is ${ENVIRONMENT}\"\n\n      # Using env. context\n      - name: Show the selected environment name using env context\n        run: echo \"Environment is ${{ env.ENVIRONMENT }}\"\n```\n\n\u003c!-- References --\u003e\n[env context]: https://docs.github.com/en/actions/learn-github-actions/contexts#example-contents-of-the-env-context\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbh-tech%2Fset-environment-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbh-tech%2Fset-environment-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbh-tech%2Fset-environment-action/lists"}