Skip to content

Use this Github Action to update a variable in your Github Action Workflows for your repository

License

Notifications You must be signed in to change notification settings

OpenFoxes/set-github-variable

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

📦

set-github-variable

A GitHub Action for updating Github Variables

Version 1.4.0

Quality gate


Information

With this Github Action you are able to modify Repository Variables right from your Github Workflow. It is very easy to integrate in your project, just take a look at the "Usage"-section.

Usage

Updates Github Variable for a repository or organization.

- uses: openfoxes/[email protected]
  with:
      name: 'SAMPLE_VAR'
      value: 'Hello World'
      repository: openfoxes/set-github-variable
      token: ${{ secrets.REPO_ACCESS_TOKEN }}

Pre-requisites

  1. Create a Github Variable for your repo/organization.
  2. Create an access token with access to manage actions repository variables.

It does not require to do checkout and it's independent on the Github runner/docker container used.

Customizing

inputs

Inputs marked as "Required" must be set.

Name Type Required Default Description
name String Yes Variable name
value String Yes Variable value
repository String Yes Repository name, with format <organization>/<repository> i.e openfoxes/set-github-variable
token String Yes Repository Token
logLevel Enum [NONE/INFO/VERBOSE] No INFO Granularity of log messages. None disables the logging.
logOldValue Boolean No true Enables/Disables logging of the previous variable value

The following are to be provided when the value is Org scoped instead of a repository variable:

Name Type Description
org Boolean Details if the variable belongs to an organization (default is false)
visibility String Configures access to the repositorys in the org, see more
selectedRepositoryIds String[Integer] Array of repositories ids where to update the org-scoped variable, see more

outputs

The following outputs can be accessed via ${{ steps.<step-id>.outputs }} from this action

Name Type Description
data String Response data from Github API
status Integer Response code from Github API

Development

This repository is based on https://github.com/mmoyaferrer/set-github-variable. It should be kept up to date, so feel free to open issues or suggest solutions. This fork is intended as a progression on the original repository and will be developed in parallel. I will try to keep it based on the original one, if there are any updates.

Code Quality

This project aims to provide a clean and secure design. In order to optimize the underlying code and reducing the risk of bugs, quality tools are used:

Quality gate

Bugs Code Smells Duplicated Lines (%)

About

Use this Github Action to update a variable in your Github Action Workflows for your repository

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%