env-output-setter

module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2025 License: MIT

README

GitHub Environment/Output Setter

License Latest Tag Top Language GitHub Marketplace

Overview

The GitHub Environment/Output Setter is a GitHub Action that allows you to set multiple key-value pairs in both $GITHUB_ENV and $GITHUB_OUTPUT. This action is useful for workflows that need to dynamically define environment variables or output values that other steps can reference.

Inputs

Input Required Description Example
env_key Yes Comma-separated list of environment variable keys "GCP_REGION,AWS_REGION"
env_value Yes Comma-separated list of environment variable values "asia-northeast1,us-east-1"
output_key Yes Comma-separated list of output keys "GCP_OUTPUT,AWS_OUTPUT"
output_value Yes Comma-separated list of output values "gcp_success,aws_success"
Example Workflow

Below is an example of how to use the GitHub Environment/Output Setter action in a GitHub Actions workflow. This example sets environment variables and output variables and then prints the success message.

name: Example Workflow
on: [push]

jobs:
  set-env-output:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout infrastructure repository
        uses: actions/checkout@v4

      - name: Set Environment and Output Variables
        id: set_variables
        uses: somaz94/github-env-output-setter@v1
        with:
          env_key: 'GCP_REGION,AWS_REGION'
          env_value: 'asia-northeast1,us-east-1'
          output_key: 'GCP_OUTPUT,AWS_OUTPUT'
          output_value: 'gcp_success,aws_success'

      - name: Display Env and Output Variables
        run: |
          echo "GCP_REGION: ${{ env.GCP_REGION }}" # asis-northeast1
          echo "AWS_REGION: ${{ env.AWS_REGION }}" # us-east-1
          echo "GCP_OUTPUT: ${{ steps.set_variables.outputs.GCP_OUTPUT }} # gcp_success
          echo "GCP_OUTPUT: ${{ steps.set_variables.outputs.AWS_OUTPUT }} # aws_success

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL