Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azu/set-env-to-github_env
A migration tools convert `::set-env`/`::set-output`/`::save-state` to $GITHUB_ENV/$GITHUB_OUTPUT/$GITHUB_STATE on GitHub Actions.
https://github.com/azu/set-env-to-github_env
actions github github-actions migration
Last synced: 8 days ago
JSON representation
A migration tools convert `::set-env`/`::set-output`/`::save-state` to $GITHUB_ENV/$GITHUB_OUTPUT/$GITHUB_STATE on GitHub Actions.
- Host: GitHub
- URL: https://github.com/azu/set-env-to-github_env
- Owner: azu
- License: mit
- Created: 2020-11-10T12:39:48.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-16T10:33:37.000Z (over 1 year ago)
- Last Synced: 2024-09-29T23:41:00.962Z (about 2 months ago)
- Topics: actions, github, github-actions, migration
- Language: TypeScript
- Homepage:
- Size: 80.1 KB
- Stars: 37
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# set-env-to-github_env [![Actions Status: test](https://github.com/azu/set-env-to-github_env/workflows/test/badge.svg)](https://github.com/azu/set-env-to-github_env/actions?query=workflow%3A"test")
A migration tools convert `::set-env` to $GITHUB_ENV on GitHub Actions.
## Supported Migration
- [x] `echo "::set-env name={name}::{value}"` → `echo "{name}={value}" >> "$GITHUB_ENV"`
- [x] `echo "::set-output name={name}::{value}"` → `echo "{name}={value}" >> "$GITHUB_OUTPUT"`
- [x] `echo "::save-state name={name}::{value}"` → `echo "{name}={value}" >> "$GITHUB_STATE"`For more details, see GitHub blog and documentation.
- [GitHub Actions: Deprecating set-env and add-path commands - GitHub Changelog](https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/)
- [GitHub Actions: Deprecating save-state and set-output commands | GitHub Changelog](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/)
- [Workflow commands for GitHub Actions - GitHub Docs](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files)TODO: This tool does not support `::add-path` migration yet.
If you are interesting in this, please see https://github.com/azu/set-env-to-github_env/issues/2## Install
Install with [npm](https://www.npmjs.com/):
npm install set-env-to-github_env
or Just use `npx` command in project root directory.npx set-env-to-github_env
**Require:** Node.js 14+
## Usage
Run command in project root directory.
Usage
$ set-env-to-github_env
Examples
$ set-env-to-github_env
# migration ./github/workflows/*.{yml,yaml}## Example
Before
```yaml
name: test
on: [push, pull_request]
jobs:
test:
name: "Test"
runs-on: ubuntu-18.04
steps:
- name: set env for prod
if: github.ref == 'refs/heads/main'
run: |
echo "::set-env name=FILE_ID::${FILE_ID}"
echo "::set-env name=BUCKET_NAME::${BUCKET_NAME}"
env:
FILE_ID: 123456789012
BUCKET_NAME: deploy-prod
```After
```yaml
name: test
on: [push, pull_request]
jobs:
test:
name: "Test"
runs-on: ubuntu-18.04
steps:
- name: set env for prod
if: github.ref == 'refs/heads/main'
run: |
echo "FILE_ID=${FILE_ID}" >> "$GITHUB_ENV"
echo "BUCKET_NAME=${BUCKET_NAME}" >> "$GITHUB_ENV"
env:
FILE_ID: 123456789012
BUCKET_NAME: deploy-prod
```## Changelog
See [Releases page](https://github.com/azu/set-env-to-github_env/releases).
## Running tests
Install devDependencies and Run `npm test`:
npm test
## Contributing
Pull requests and stars are always welcome.
For bugs and feature requests, [please create an issue](https://github.com/azu/set-env-to-github_env/issues).
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D## Author
- azu: [GitHub](https://github.com/azu), [Twitter](https://twitter.com/azu_re)
## License
MIT © azu