GithubHelp home page GithubHelp logo

azu / set-env-to-github_env Goto Github PK

View Code? Open in Web Editor NEW
37.0 3.0 6.0 82 KB

A migration tools convert `::set-env`/`::set-output`/`::save-state` to $GITHUB_ENV/$GITHUB_OUTPUT/$GITHUB_STATE on GitHub Actions.

License: MIT License

JavaScript 11.44% TypeScript 87.49% Shell 1.07%
github actions migration github-actions

set-env-to-github_env's Introduction

set-env-to-github_env Actions Status: test

A migration tools convert ::set-env to $GITHUB_ENV on GitHub Actions.

Supported Migration

  • echo "::set-env name={name}::{value}"echo "{name}={value}" >> "$GITHUB_ENV"
  • echo "::set-output name={name}::{value}"echo "{name}={value}" >> "$GITHUB_OUTPUT"
  • echo "::save-state name={name}::{value}"echo "{name}={value}" >> "$GITHUB_STATE"

For more details, see GitHub blog and documentation.

TODO: This tool does not support ::add-path migration yet. If you are interesting in this, please see #2

Install

Install with npm:

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

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

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.

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.

  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

License

MIT © azu

set-env-to-github_env's People

Contributors

azu avatar hogashi avatar itchyny avatar nowsprinting avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

set-env-to-github_env's Issues

Add add-path support

echo "::add-path::$HOME/bin"

to be

echo "$HOME/bin" >> $GITHUB_PATH

Welcome to PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.