Giter Site home page Giter Site logo

nichmor / minimal-read-yaml Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pietrobolcato/action-read-yaml

4.0 0.0 0.0 1.23 MB

Custom github action used to read yaml files, supporting multiple keys and variable replacements

JavaScript 100.00%

minimal-read-yaml's Introduction

Minimal YAML Reader: A GitHub Action ๐Ÿ“

This action reads a .yaml file and sets one output for every key it contains. It aims to be minimal and simple.

Why? ๐Ÿค”

Present solutions often do more than one thing (and do them well), but they are not intuitive to set up or use. Some have unresolved issues, and others don't work on Windows.

minimal-yaml-read is designed to be very simple to use and do only one thing: read a YAML file.

Credits: pietrobolcato/action-read-yaml, which served as the base for this GitHub Action.

Configuration Keys ๐Ÿ”ง

There is one mandatory configuration key: config.

config

This key specifies the path to the YAML file that the action should read. It is required.

Example Usage ๐Ÿ“„

Let's use a simple example that contains some nested values:

Copy code
name: example
environment:
  name: example
  permissions:
    - name: example
      permission: read
    - name: example2
      permission: write

To access a plain key, use:

echo ${{ steps.read-yaml.outputs['name'] }}

To access a nested key, use:

echo ${{ steps.read-yaml.outputs['environment.name'] }}

Full Example Workflow ๐Ÿ› ๏ธ

Here is a complete example of a GitHub Actions workflow using the minimal-yaml-read action:

name: Example Workflow

on: [push]

jobs:
  read-yaml-job:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: Read YAML
        uses: nichmor/[email protected]
        with:
          config: path/to/your/config.yaml

      - name: Access Output
        run: echo ${{ steps.read-yaml.outputs['environment.name'] }}

In this example, the minimal-yaml-read action reads the specified YAML file and sets outputs for each key. You can then access these outputs in subsequent steps using the ${{ steps.read-yaml.outputs['key'] }} syntax.

minimal-read-yaml's People

Contributors

pietrobolcato avatar ehsandanesh avatar nichmor avatar ndelangen avatar hyorman avatar

Stargazers

Raul Wagner Costa avatar Wolf Vollprecht avatar Ruben Arts avatar  avatar

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.