{"id":13531143,"url":"https://github.com/SpicyPizza/create-envfile","last_synced_at":"2025-04-01T19:31:37.174Z","repository":{"id":37805601,"uuid":"203468490","full_name":"SpicyPizza/create-envfile","owner":"SpicyPizza","description":"Github Action to create a .env file with Github Secrets","archived":false,"fork":false,"pushed_at":"2024-02-21T13:14:33.000Z","size":1250,"stargazers_count":440,"open_issues_count":16,"forks_count":75,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T12:13:07.804Z","etag":null,"topics":["actions","continuous-integration","environment-variables","github-actions"],"latest_commit_sha":null,"homepage":"","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/SpicyPizza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2019-08-20T23:16:32.000Z","updated_at":"2025-03-26T04:02:59.000Z","dependencies_parsed_at":"2023-01-04T12:15:09.334Z","dependency_job_id":"265a9ce6-71f5-4b31-817f-9992e2743cfc","html_url":"https://github.com/SpicyPizza/create-envfile","commit_stats":{"total_commits":98,"total_committers":11,"mean_commits":8.909090909090908,"dds":0.3163265306122449,"last_synced_commit":"991bed69393dc4421243f03797a28ad1f0ea662a"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpicyPizza%2Fcreate-envfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpicyPizza%2Fcreate-envfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpicyPizza%2Fcreate-envfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpicyPizza%2Fcreate-envfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpicyPizza","download_url":"https://codeload.github.com/SpicyPizza/create-envfile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246700368,"owners_count":20819862,"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":["actions","continuous-integration","environment-variables","github-actions"],"created_at":"2024-08-01T07:01:00.438Z","updated_at":"2025-04-01T19:31:32.163Z","avatar_url":"https://github.com/SpicyPizza.png","language":"TypeScript","readme":"# Create .Env File GitHub Action\n\n[![GitHub\nrelease](https://img.shields.io/github/release/SpicyPizza/create-envfile.svg?style=flat-square)](https://github.com/SpicyPizza/create-envfile/releases/latest)\n[![GitHub\nmarketplace](https://img.shields.io/badge/marketplace-create--env--file-blue?logo=github\u0026style=flat-square)](https://github.com/marketplace/actions/create-env-file)\n[![Licence](https://img.shields.io/github/license/SpicyPizza/create-envfile)](https://github.com/SpicyPizza/create-envfile/blob/main/LICENSE)\n\n## About\n\nA GitHub Action to create an '.env' file with GitHub Secrets. This is useful\nwhen you are creating artifacts that contain values stored in GitHub Secrets.\nThis creates a file with variables that are defined in the Action config.\n\n## Usage\n\nThe Action looks for environment variables that start with `envkey_` and creates\nan '.env' file with them. These are defined in the `with` section of the Action\nconfig. Here is an example of it in use:\n\n```yml\nname: Create envfile\n\non: [ push ]\n\njobs:\n\n  create-envfile:\n \n    runs-on: ubuntu-latest\n \n    steps:\n    - name: Make envfile\n      uses: SpicyPizza/create-envfile@v2.0\n      with:\n        envkey_DEBUG: false\n        envkey_SOME_API_KEY: \"123456abcdef\"\n        envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }}\n        envkey_VARIABLE: ${{ vars.SOME_ACTION_VARIABLE }}\n        some_other_variable: foobar\n        directory: \u003cdirectory_name\u003e\n        file_name: .env\n        fail_on_empty: false\n        sort_keys: false\n```\n\n## Inputs\n\nIn the example above, there are several key/value pairs that will be added to\nthe '.env' file:\n\n| Name                                  | Description                                                                                                                                                              |\n| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `envkey_DEBUG`, `envkey_SOME_API_KEY` | These values can be whatever, and they will be added to the '.env' file as `DEBUG` and `SOME_API_KEY` .                                                                  |\n| `envkey_SECRET_KEY`                   | This one will use a secret stored in the repository's GitHub Secrets, and add it to the file as  `SECRET_KEY`                                                            |\n| `directory` (**Optional**)            | This key will set the directory in which you want to create `env` file. **Important: cannot start with `/`. Action will fail if the specified directory doesn't exist.** |\n| `file_name` (**Optional**)            | Set the name of the output '.env' file. Defaults to `.env`                                                                                                               |\n| `fail_on_empty` (**Optional**)        | If set to true, the Action will fail if any env key is empty. Default to `false`.                                                                                        |\n| `sort_keys` (**Optional**)            | If set to true, the Action will sort the keys in the output '.env' file. Default to `false`.                                                                             |\n\nAssuming that the GitHub Secret that was used is `password123`, the '.env' file\nthat is created from the config above would contain:\n\n```text\nDEBUG=false\nSOME_API_KEY=\"123456abcdef\"\nSECRET_KEY=password123\n```\n\n### Multiline Secrets\n\nThis Action supports multiline secrets, as described in [the nodejs dotenv\nreadme](https://github.com/motdotla/dotenv#multiline-values).\n\nYou may have a secret that requres multiple lines, like a private key. You can\nstore this in a GitHub Secret, and use it as any other secret in this Action:\n\n```sh\nPRIVATE_KEY=\"-----BEGIN RSA PRIVATE KEY-----\n...\nKh9NV...\n...\n-----END RSA PRIVATE KEY-----\"\n```\n\nIt will get stored as a single line in the '.env' file. This line will start and\nend with a `\"` character, and will contain `\\n` characters to represent the\nnewlines:\n\n```sh\nPRIVATE_KEY=\"-----BEGIN RSA PRIVATE KEY-----\\nKh9NV...\\n-----END RSA PRIVATE KEY-----\\n\"\n```\n\n## Potential Issues\n\n### Warnings\n\nWhen the Action runs, it will show `Warning: Unexpected input(s) ...`. This is\nbecause GitHub is expecting all the potential input variables to be defined by\nthe Action's definition. You can read more about it in [this\nissue](https://github.com/SpicyPizza/create-envfile/issues/10).\n\n![](https://user-images.githubusercontent.com/12802646/106284483-594e2300-6254-11eb-9e5d-3a6426da0435.png)\n","funding_links":[],"categories":["Community Resources","五、按场景分类的实用Action"],"sub_categories":["Utility","8. 环境配置"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSpicyPizza%2Fcreate-envfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSpicyPizza%2Fcreate-envfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSpicyPizza%2Fcreate-envfile/lists"}