Skip to content
refresh-cw

GitHub Action

Set Github Variable by Open Foxes

v1.4.0 Latest version

Set Github Variable by Open Foxes

refresh-cw

Set Github Variable by Open Foxes

Update Github variables from within actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Set Github Variable by Open Foxes

uses: OpenFoxes/set-github-variable@v1.4.0

Learn more about this action in OpenFoxes/set-github-variable

Choose a version

📦

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/set-github-variable@v1.4.0
  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 (%)