{"id":15754655,"url":"https://github.com/gableroux/travis-multiline-env-example","last_synced_at":"2026-01-12T00:39:56.864Z","repository":{"id":145782639,"uuid":"133205800","full_name":"GabLeRoux/travis-multiline-env-example","owner":"GabLeRoux","description":"📚Convert mutli line environment variable to file with Travis-ci in project settings","archived":false,"fork":false,"pushed_at":"2018-09-14T18:15:37.000Z","size":4,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T08:13:00.891Z","etag":null,"topics":["environment-variables","example","file","travis-ci"],"latest_commit_sha":null,"homepage":"https://github.com/travis-ci/travis-ci/issues/7715#issuecomment-362536708","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GabLeRoux.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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":"2018-05-13T04:35:15.000Z","updated_at":"2020-09-24T12:19:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"e862f3cb-963b-4813-85b2-0868256429db","html_url":"https://github.com/GabLeRoux/travis-multiline-env-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GabLeRoux/travis-multiline-env-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Ftravis-multiline-env-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Ftravis-multiline-env-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Ftravis-multiline-env-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Ftravis-multiline-env-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GabLeRoux","download_url":"https://codeload.github.com/GabLeRoux/travis-multiline-env-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Ftravis-multiline-env-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28329806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["environment-variables","example","file","travis-ci"],"created_at":"2024-10-04T08:04:10.482Z","updated_at":"2026-01-12T00:39:56.842Z","avatar_url":"https://github.com/GabLeRoux.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Travis-CI multiline env variables example\n\n[![Build Status](https://travis-ci.com/GabLeRoux/travis-multiline-env-example.svg?branch=master)](https://travis-ci.com/GabLeRoux/travis-multiline-env-example)\n\nI needed to generate a file based on an environment variable which contains multiple lines. Note: `gitlab-ci` does support this out of the boxs. I just needed to do the same with Travis. :v:\n\n## The solution\n\nAs described in [travis-ci#7715](https://github.com/travis-ci/travis-ci/issues/7715#issuecomment-362536708), we can replace end lines by `\\n` and wrap the environment variable in settings with `\"$(echo -e '` and `')\"`.\n\n### Example:\n\nExpected content\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\u003croot\u003e\n    \u003cExample id=\"hello\"\u003e\n        \u003cTest /\u003e\n    \u003c/Example\u003e\n\u003c/root\u003e\n```\n\nThe above content with endlines replaced:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\u003croot\u003e\\n    \u003cExample id=\"hello\"\u003e\\n        \u003cTest /\u003e\\n    \u003c/Example\u003e\\n\u003c/root\u003e\n```\n\nWhat we actually need to add in Travis environment variables settings:\n\n```xml\n\"$(echo -e '\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\u003croot\u003e\\n    \u003cExample id=\"hello\"\u003e\\n        \u003cTest /\u003e\\n    \u003c/Example\u003e\\n\u003c/root\u003e')\"\n```\n\n:white_check_mark: [Confirmed working here](https://travis-ci.com/GabLeRoux/travis-multiline-env-example)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgableroux%2Ftravis-multiline-env-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgableroux%2Ftravis-multiline-env-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgableroux%2Ftravis-multiline-env-example/lists"}