{"id":18884166,"url":"https://github.com/dcarbone/yaml-to-env-action","last_synced_at":"2025-04-14T21:13:16.136Z","repository":{"id":60360402,"uuid":"542601565","full_name":"dcarbone/yaml-to-env-action","owner":"dcarbone","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-19T22:58:38.000Z","size":57,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T21:13:09.860Z","etag":null,"topics":["action","actions","environment-variables","github-actions","workflows","yaml"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcarbone.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-28T13:22:00.000Z","updated_at":"2024-11-19T22:58:03.000Z","dependencies_parsed_at":"2024-11-16T05:01:52.372Z","dependency_job_id":null,"html_url":"https://github.com/dcarbone/yaml-to-env-action","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"a38149bfc98b05648e15b608206cae50074c4d84"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fyaml-to-env-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fyaml-to-env-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fyaml-to-env-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fyaml-to-env-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcarbone","download_url":"https://codeload.github.com/dcarbone/yaml-to-env-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961237,"owners_count":21189993,"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","actions","environment-variables","github-actions","workflows","yaml"],"created_at":"2024-11-08T07:11:27.316Z","updated_at":"2025-04-14T21:13:16.105Z","avatar_url":"https://github.com/dcarbone.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YAML to ENV GitHub Action\n\n[GitHub Action](https://docs.github.com/en/actions) that reads values from a YAML file, setting them into the `$GITHUB_ENV` of a job.\n\n\u003c!-- TOC --\u003e\n* [YAML to ENV GitHub Action](#yaml-to-env-github-action)\n  * [Example Workflow](#example-workflow)\n  * [Conversion Rules](#conversion-rules)\n    * [Names](#names)\n      * [Simple](#simple)\n      * [Nested Object](#nested-object)\n      * [Multiline value](#multiline-value)\n  * [Action Inputs](#action-inputs)\n      * [yaml-file](#yaml-file)\n      * [yq-version](#yq-version)\n      * [mask-values](#mask-values)\n  * [Action Outputs](#action-outputs)\n      * [yq-installed](#yq-installed)\n      * [var-count](#var-count)\n      * [yaml-keys](#yaml-keys)\n      * [env-names](#env-names)\n\u003c!-- TOC --\u003e\n\n## Example Workflow\n\nYou can see an example workflow here: [example.yaml](./example.yaml)\n\n## Conversion Rules\n\n### Names\n\nKey to env name happens using the following script:\n\n```shell\ntr '[:lower:]' '[:upper:]' | sed -E 's/[^a-zA-Z0-9_]/_/g';\n```\n\nYou can see the exact logic [here](./scripts/yaml-to-env.sh)\n\n#### Simple\n\nSource YAML:\n```yaml\nkey: value\n```\n\nOutput env:\n```text\nKEY=value\n```\n\n#### Nested Object\n\nSource YAML:\n```yaml\nobject:\n  key1: value1\n  key2: value 2\n  key3:\n    - nested value 1\n    - nested value 2\n```\n\nOutput env:\n```text\nOBJECT_KEY1=value1\nOBJECT_KEY2=value 2\nOBJECT_KEY3_0=nested value 1\nOBJECT_KEY3_1=nested value 2\n```\n\n#### Multiline value\n\nSource YAML:\n```yaml\nmultiline: |\n  value with\n  more than 1 line\n```\n\nOutput env:\n```text\nMULTILINE\u003c\u003cEOF\nvalue with\nmore than 1 line\nEOF\n```\n\n## Action Inputs\n\n#### yaml-file\n```yaml\n  yaml-file:\n    required: true\n    description: \"Filepath to YAML to parse\"\n```\n\n#### yq-version\n```yaml\n  yq-version:\n    required: false\n    default: \"4.27.5\"\n    description: \"Version of yq to install, if not already in path.  Tested with \u003e= 4.25.\"\n```\n\n#### mask-values\n```yaml\n  mask-values:\n    required: false\n    default: \"false\"\n    description: \"Add value masking to all exported environment variable values (https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#example-masking-an-environment-variable)\"\n```\n\n## Action Outputs\n\n#### yq-installed\n```yaml\n  yq-installed:\n    description: \"'true' if yq was installed by this action\"\n```\n\n#### var-count\n```yaml\n  var-count:\n    description: \"Number of environment variables defined from source YAML file.\"\n```\n\n#### yaml-keys\n```yaml\n  yaml-keys:\n    description: \"Comma-separated string of keys extracted from source YAML file.\"\n```\n\n#### env-names\n```yaml\n  env-names:\n    description: \"Comma-separated string of exported environment variable names\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcarbone%2Fyaml-to-env-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcarbone%2Fyaml-to-env-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcarbone%2Fyaml-to-env-action/lists"}