1. Packages
  2. Github Provider
  3. API Docs
  4. ActionsOrganizationVariable
Viewing docs for GitHub v6.12.1
published on Thursday, Feb 12, 2026 by Pulumi
github logo
Viewing docs for GitHub v6.12.1
published on Thursday, Feb 12, 2026 by Pulumi

    This resource allows you to create and manage GitHub Actions variables within your GitHub organization. You must have write access to a repository to use this resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const exampleVariable = new github.ActionsOrganizationVariable("example_variable", {
        variableName: "example_variable_name",
        visibility: "private",
        value: "example_variable_value",
    });
    
    import pulumi
    import pulumi_github as github
    
    example_variable = github.ActionsOrganizationVariable("example_variable",
        variable_name="example_variable_name",
        visibility="private",
        value="example_variable_value")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := github.NewActionsOrganizationVariable(ctx, "example_variable", &github.ActionsOrganizationVariableArgs{
    			VariableName: pulumi.String("example_variable_name"),
    			Visibility:   pulumi.String("private"),
    			Value:        pulumi.String("example_variable_value"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleVariable = new Github.ActionsOrganizationVariable("example_variable", new()
        {
            VariableName = "example_variable_name",
            Visibility = "private",
            Value = "example_variable_value",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.ActionsOrganizationVariable;
    import com.pulumi.github.ActionsOrganizationVariableArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var exampleVariable = new ActionsOrganizationVariable("exampleVariable", ActionsOrganizationVariableArgs.builder()
                .variableName("example_variable_name")
                .visibility("private")
                .value("example_variable_value")
                .build());
    
        }
    }
    
    resources:
      exampleVariable:
        type: github:ActionsOrganizationVariable
        name: example_variable
        properties:
          variableName: example_variable_name
          visibility: private
          value: example_variable_value
    
    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const repo = github.getRepository({
        fullName: "my-org/repo",
    });
    const exampleVariable = new github.ActionsOrganizationVariable("example_variable", {
        variableName: "example_variable_name",
        visibility: "selected",
        value: "example_variable_value",
        selectedRepositoryIds: [repo.then(repo => repo.repoId)],
    });
    
    import pulumi
    import pulumi_github as github
    
    repo = github.get_repository(full_name="my-org/repo")
    example_variable = github.ActionsOrganizationVariable("example_variable",
        variable_name="example_variable_name",
        visibility="selected",
        value="example_variable_value",
        selected_repository_ids=[repo.repo_id])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		repo, err := github.LookupRepository(ctx, &github.LookupRepositoryArgs{
    			FullName: pulumi.StringRef("my-org/repo"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = github.NewActionsOrganizationVariable(ctx, "example_variable", &github.ActionsOrganizationVariableArgs{
    			VariableName: pulumi.String("example_variable_name"),
    			Visibility:   pulumi.String("selected"),
    			Value:        pulumi.String("example_variable_value"),
    			SelectedRepositoryIds: pulumi.IntArray{
    				pulumi.Int(repo.RepoId),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var repo = Github.GetRepository.Invoke(new()
        {
            FullName = "my-org/repo",
        });
    
        var exampleVariable = new Github.ActionsOrganizationVariable("example_variable", new()
        {
            VariableName = "example_variable_name",
            Visibility = "selected",
            Value = "example_variable_value",
            SelectedRepositoryIds = new[]
            {
                repo.Apply(getRepositoryResult => getRepositoryResult.RepoId),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.GithubFunctions;
    import com.pulumi.github.inputs.GetRepositoryArgs;
    import com.pulumi.github.ActionsOrganizationVariable;
    import com.pulumi.github.ActionsOrganizationVariableArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var repo = GithubFunctions.getRepository(GetRepositoryArgs.builder()
                .fullName("my-org/repo")
                .build());
    
            var exampleVariable = new ActionsOrganizationVariable("exampleVariable", ActionsOrganizationVariableArgs.builder()
                .variableName("example_variable_name")
                .visibility("selected")
                .value("example_variable_value")
                .selectedRepositoryIds(repo.repoId())
                .build());
    
        }
    }
    
    resources:
      exampleVariable:
        type: github:ActionsOrganizationVariable
        name: example_variable
        properties:
          variableName: example_variable_name
          visibility: selected
          value: example_variable_value
          selectedRepositoryIds:
            - ${repo.repoId}
    variables:
      repo:
        fn::invoke:
          function: github:getRepository
          arguments:
            fullName: my-org/repo
    

    Create ActionsOrganizationVariable Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ActionsOrganizationVariable(name: string, args: ActionsOrganizationVariableArgs, opts?: CustomResourceOptions);
    @overload
    def ActionsOrganizationVariable(resource_name: str,
                                    args: ActionsOrganizationVariableArgs,
                                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def ActionsOrganizationVariable(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    value: Optional[str] = None,
                                    variable_name: Optional[str] = None,
                                    visibility: Optional[str] = None,
                                    selected_repository_ids: Optional[Sequence[int]] = None)
    func NewActionsOrganizationVariable(ctx *Context, name string, args ActionsOrganizationVariableArgs, opts ...ResourceOption) (*ActionsOrganizationVariable, error)
    public ActionsOrganizationVariable(string name, ActionsOrganizationVariableArgs args, CustomResourceOptions? opts = null)
    public ActionsOrganizationVariable(String name, ActionsOrganizationVariableArgs args)
    public ActionsOrganizationVariable(String name, ActionsOrganizationVariableArgs args, CustomResourceOptions options)
    
    type: github:ActionsOrganizationVariable
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var actionsOrganizationVariableResource = new Github.ActionsOrganizationVariable("actionsOrganizationVariableResource", new()
    {
        Value = "string",
        VariableName = "string",
        Visibility = "string",
        SelectedRepositoryIds = new[]
        {
            0,
        },
    });
    
    example, err := github.NewActionsOrganizationVariable(ctx, "actionsOrganizationVariableResource", &github.ActionsOrganizationVariableArgs{
    	Value:        pulumi.String("string"),
    	VariableName: pulumi.String("string"),
    	Visibility:   pulumi.String("string"),
    	SelectedRepositoryIds: pulumi.IntArray{
    		pulumi.Int(0),
    	},
    })
    
    var actionsOrganizationVariableResource = new ActionsOrganizationVariable("actionsOrganizationVariableResource", ActionsOrganizationVariableArgs.builder()
        .value("string")
        .variableName("string")
        .visibility("string")
        .selectedRepositoryIds(0)
        .build());
    
    actions_organization_variable_resource = github.ActionsOrganizationVariable("actionsOrganizationVariableResource",
        value="string",
        variable_name="string",
        visibility="string",
        selected_repository_ids=[0])
    
    const actionsOrganizationVariableResource = new github.ActionsOrganizationVariable("actionsOrganizationVariableResource", {
        value: "string",
        variableName: "string",
        visibility: "string",
        selectedRepositoryIds: [0],
    });
    
    type: github:ActionsOrganizationVariable
    properties:
        selectedRepositoryIds:
            - 0
        value: string
        variableName: string
        visibility: string
    

    ActionsOrganizationVariable Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ActionsOrganizationVariable resource accepts the following input properties:

    Value string
    Value of the variable.
    VariableName string
    Name of the variable.
    Visibility string
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    SelectedRepositoryIds List<int>
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    Value string
    Value of the variable.
    VariableName string
    Name of the variable.
    Visibility string
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    SelectedRepositoryIds []int
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    value String
    Value of the variable.
    variableName String
    Name of the variable.
    visibility String
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    selectedRepositoryIds List<Integer>
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    value string
    Value of the variable.
    variableName string
    Name of the variable.
    visibility string
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    selectedRepositoryIds number[]
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    value str
    Value of the variable.
    variable_name str
    Name of the variable.
    visibility str
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    selected_repository_ids Sequence[int]
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    value String
    Value of the variable.
    variableName String
    Name of the variable.
    visibility String
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    selectedRepositoryIds List<Number>
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ActionsOrganizationVariable resource produces the following output properties:

    CreatedAt string
    Date the variable was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    Date the variable was last updated.
    CreatedAt string
    Date the variable was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    Date the variable was last updated.
    createdAt String
    Date the variable was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    Date the variable was last updated.
    createdAt string
    Date the variable was created.
    id string
    The provider-assigned unique ID for this managed resource.
    updatedAt string
    Date the variable was last updated.
    created_at str
    Date the variable was created.
    id str
    The provider-assigned unique ID for this managed resource.
    updated_at str
    Date the variable was last updated.
    createdAt String
    Date the variable was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    Date the variable was last updated.

    Look up Existing ActionsOrganizationVariable Resource

    Get an existing ActionsOrganizationVariable resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ActionsOrganizationVariableState, opts?: CustomResourceOptions): ActionsOrganizationVariable
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            selected_repository_ids: Optional[Sequence[int]] = None,
            updated_at: Optional[str] = None,
            value: Optional[str] = None,
            variable_name: Optional[str] = None,
            visibility: Optional[str] = None) -> ActionsOrganizationVariable
    func GetActionsOrganizationVariable(ctx *Context, name string, id IDInput, state *ActionsOrganizationVariableState, opts ...ResourceOption) (*ActionsOrganizationVariable, error)
    public static ActionsOrganizationVariable Get(string name, Input<string> id, ActionsOrganizationVariableState? state, CustomResourceOptions? opts = null)
    public static ActionsOrganizationVariable get(String name, Output<String> id, ActionsOrganizationVariableState state, CustomResourceOptions options)
    resources:  _:    type: github:ActionsOrganizationVariable    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreatedAt string
    Date the variable was created.
    SelectedRepositoryIds List<int>
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    UpdatedAt string
    Date the variable was last updated.
    Value string
    Value of the variable.
    VariableName string
    Name of the variable.
    Visibility string
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    CreatedAt string
    Date the variable was created.
    SelectedRepositoryIds []int
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    UpdatedAt string
    Date the variable was last updated.
    Value string
    Value of the variable.
    VariableName string
    Name of the variable.
    Visibility string
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    createdAt String
    Date the variable was created.
    selectedRepositoryIds List<Integer>
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    updatedAt String
    Date the variable was last updated.
    value String
    Value of the variable.
    variableName String
    Name of the variable.
    visibility String
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    createdAt string
    Date the variable was created.
    selectedRepositoryIds number[]
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    updatedAt string
    Date the variable was last updated.
    value string
    Value of the variable.
    variableName string
    Name of the variable.
    visibility string
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    created_at str
    Date the variable was created.
    selected_repository_ids Sequence[int]
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    updated_at str
    Date the variable was last updated.
    value str
    Value of the variable.
    variable_name str
    Name of the variable.
    visibility str
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.
    createdAt String
    Date the variable was created.
    selectedRepositoryIds List<Number>
    An array of repository IDs that can access the organization variable; this requires visibility to be set to selected.
    updatedAt String
    Date the variable was last updated.
    value String
    Value of the variable.
    variableName String
    Name of the variable.
    visibility String
    Configures the access that repositories have to the organization variable; must be one of all, private, or selected.

    Import

    Import Command

    The following command imports a GitHub actions organization variable named myvariable to a github_actions_organization_variable resource named example.

    $ pulumi import github:index/actionsOrganizationVariable:ActionsOrganizationVariable example myvariable
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    Viewing docs for GitHub v6.12.1
    published on Thursday, Feb 12, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.