Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
refresh-cw

GitHub Action

Set Github Variable by Open Foxes

v1.2.1

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.2.1

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

Choose a version

📦

set-github-variable

A GitHub Action for updating Github Variables


Usage

Updates Github Variable for a repository or organization.

- uses: openfoxes/set-github-variable@v1.2.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

The following are required

Name Type Description
name String Variable name
value String Variable value
repository String Repository name, with format <organization>/<repository> i.e mmoyaferrer/set-github-variable
token String Repository Token
logOldValue Boolean Enables/Disables logging of the previous variable value

The following are optional, 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