This resource allows you to manage GitHub Actions workflow permissions for a GitHub Enterprise account. This controls the default permissions granted to the GITHUB_TOKEN when running workflows and whether GitHub Actions can approve pull request reviews.
You must have enterprise admin access to use this resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
// Basic workflow permissions configuration
const example = new github.EnterpriseActionsWorkflowPermissions("example", {
enterpriseSlug: "my-enterprise",
defaultWorkflowPermissions: "read",
canApprovePullRequestReviews: false,
});
// Allow write permissions and PR approvals
const permissive = new github.EnterpriseActionsWorkflowPermissions("permissive", {
enterpriseSlug: "my-enterprise",
defaultWorkflowPermissions: "write",
canApprovePullRequestReviews: true,
});
import pulumi
import pulumi_github as github
# Basic workflow permissions configuration
example = github.EnterpriseActionsWorkflowPermissions("example",
enterprise_slug="my-enterprise",
default_workflow_permissions="read",
can_approve_pull_request_reviews=False)
# Allow write permissions and PR approvals
permissive = github.EnterpriseActionsWorkflowPermissions("permissive",
enterprise_slug="my-enterprise",
default_workflow_permissions="write",
can_approve_pull_request_reviews=True)
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 {
// Basic workflow permissions configuration
_, err := github.NewEnterpriseActionsWorkflowPermissions(ctx, "example", &github.EnterpriseActionsWorkflowPermissionsArgs{
EnterpriseSlug: pulumi.String("my-enterprise"),
DefaultWorkflowPermissions: pulumi.String("read"),
CanApprovePullRequestReviews: pulumi.Bool(false),
})
if err != nil {
return err
}
// Allow write permissions and PR approvals
_, err = github.NewEnterpriseActionsWorkflowPermissions(ctx, "permissive", &github.EnterpriseActionsWorkflowPermissionsArgs{
EnterpriseSlug: pulumi.String("my-enterprise"),
DefaultWorkflowPermissions: pulumi.String("write"),
CanApprovePullRequestReviews: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
// Basic workflow permissions configuration
var example = new Github.EnterpriseActionsWorkflowPermissions("example", new()
{
EnterpriseSlug = "my-enterprise",
DefaultWorkflowPermissions = "read",
CanApprovePullRequestReviews = false,
});
// Allow write permissions and PR approvals
var permissive = new Github.EnterpriseActionsWorkflowPermissions("permissive", new()
{
EnterpriseSlug = "my-enterprise",
DefaultWorkflowPermissions = "write",
CanApprovePullRequestReviews = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.EnterpriseActionsWorkflowPermissions;
import com.pulumi.github.EnterpriseActionsWorkflowPermissionsArgs;
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) {
// Basic workflow permissions configuration
var example = new EnterpriseActionsWorkflowPermissions("example", EnterpriseActionsWorkflowPermissionsArgs.builder()
.enterpriseSlug("my-enterprise")
.defaultWorkflowPermissions("read")
.canApprovePullRequestReviews(false)
.build());
// Allow write permissions and PR approvals
var permissive = new EnterpriseActionsWorkflowPermissions("permissive", EnterpriseActionsWorkflowPermissionsArgs.builder()
.enterpriseSlug("my-enterprise")
.defaultWorkflowPermissions("write")
.canApprovePullRequestReviews(true)
.build());
}
}
resources:
# Basic workflow permissions configuration
example:
type: github:EnterpriseActionsWorkflowPermissions
properties:
enterpriseSlug: my-enterprise
defaultWorkflowPermissions: read
canApprovePullRequestReviews: false
# Allow write permissions and PR approvals
permissive:
type: github:EnterpriseActionsWorkflowPermissions
properties:
enterpriseSlug: my-enterprise
defaultWorkflowPermissions: write
canApprovePullRequestReviews: true
Notes
Note: This resource requires a GitHub Enterprise account and enterprise admin permissions.
When this resource is destroyed, the workflow permissions will be reset to safe defaults:
default_workflow_permissions=readcan_approve_pull_request_reviews=false
Create EnterpriseActionsWorkflowPermissions Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EnterpriseActionsWorkflowPermissions(name: string, args: EnterpriseActionsWorkflowPermissionsArgs, opts?: CustomResourceOptions);@overload
def EnterpriseActionsWorkflowPermissions(resource_name: str,
args: EnterpriseActionsWorkflowPermissionsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EnterpriseActionsWorkflowPermissions(resource_name: str,
opts: Optional[ResourceOptions] = None,
enterprise_slug: Optional[str] = None,
can_approve_pull_request_reviews: Optional[bool] = None,
default_workflow_permissions: Optional[str] = None)func NewEnterpriseActionsWorkflowPermissions(ctx *Context, name string, args EnterpriseActionsWorkflowPermissionsArgs, opts ...ResourceOption) (*EnterpriseActionsWorkflowPermissions, error)public EnterpriseActionsWorkflowPermissions(string name, EnterpriseActionsWorkflowPermissionsArgs args, CustomResourceOptions? opts = null)
public EnterpriseActionsWorkflowPermissions(String name, EnterpriseActionsWorkflowPermissionsArgs args)
public EnterpriseActionsWorkflowPermissions(String name, EnterpriseActionsWorkflowPermissionsArgs args, CustomResourceOptions options)
type: github:EnterpriseActionsWorkflowPermissions
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 EnterpriseActionsWorkflowPermissionsArgs
- 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 EnterpriseActionsWorkflowPermissionsArgs
- 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 EnterpriseActionsWorkflowPermissionsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EnterpriseActionsWorkflowPermissionsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EnterpriseActionsWorkflowPermissionsArgs
- 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 enterpriseActionsWorkflowPermissionsResource = new Github.EnterpriseActionsWorkflowPermissions("enterpriseActionsWorkflowPermissionsResource", new()
{
EnterpriseSlug = "string",
CanApprovePullRequestReviews = false,
DefaultWorkflowPermissions = "string",
});
example, err := github.NewEnterpriseActionsWorkflowPermissions(ctx, "enterpriseActionsWorkflowPermissionsResource", &github.EnterpriseActionsWorkflowPermissionsArgs{
EnterpriseSlug: pulumi.String("string"),
CanApprovePullRequestReviews: pulumi.Bool(false),
DefaultWorkflowPermissions: pulumi.String("string"),
})
var enterpriseActionsWorkflowPermissionsResource = new EnterpriseActionsWorkflowPermissions("enterpriseActionsWorkflowPermissionsResource", EnterpriseActionsWorkflowPermissionsArgs.builder()
.enterpriseSlug("string")
.canApprovePullRequestReviews(false)
.defaultWorkflowPermissions("string")
.build());
enterprise_actions_workflow_permissions_resource = github.EnterpriseActionsWorkflowPermissions("enterpriseActionsWorkflowPermissionsResource",
enterprise_slug="string",
can_approve_pull_request_reviews=False,
default_workflow_permissions="string")
const enterpriseActionsWorkflowPermissionsResource = new github.EnterpriseActionsWorkflowPermissions("enterpriseActionsWorkflowPermissionsResource", {
enterpriseSlug: "string",
canApprovePullRequestReviews: false,
defaultWorkflowPermissions: "string",
});
type: github:EnterpriseActionsWorkflowPermissions
properties:
canApprovePullRequestReviews: false
defaultWorkflowPermissions: string
enterpriseSlug: string
EnterpriseActionsWorkflowPermissions 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 EnterpriseActionsWorkflowPermissions resource accepts the following input properties:
- Enterprise
Slug string - The slug of the enterprise.
- Can
Approve boolPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread.
- Enterprise
Slug string - The slug of the enterprise.
- Can
Approve boolPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread.
- enterprise
Slug String - The slug of the enterprise.
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread.
- enterprise
Slug string - The slug of the enterprise.
- can
Approve booleanPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread.
- enterprise_
slug str - The slug of the enterprise.
- can_
approve_ boolpull_ request_ reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default_
workflow_ strpermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread.
- enterprise
Slug String - The slug of the enterprise.
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread.
Outputs
All input properties are implicitly available as output properties. Additionally, the EnterpriseActionsWorkflowPermissions resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing EnterpriseActionsWorkflowPermissions Resource
Get an existing EnterpriseActionsWorkflowPermissions 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?: EnterpriseActionsWorkflowPermissionsState, opts?: CustomResourceOptions): EnterpriseActionsWorkflowPermissions@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
can_approve_pull_request_reviews: Optional[bool] = None,
default_workflow_permissions: Optional[str] = None,
enterprise_slug: Optional[str] = None) -> EnterpriseActionsWorkflowPermissionsfunc GetEnterpriseActionsWorkflowPermissions(ctx *Context, name string, id IDInput, state *EnterpriseActionsWorkflowPermissionsState, opts ...ResourceOption) (*EnterpriseActionsWorkflowPermissions, error)public static EnterpriseActionsWorkflowPermissions Get(string name, Input<string> id, EnterpriseActionsWorkflowPermissionsState? state, CustomResourceOptions? opts = null)public static EnterpriseActionsWorkflowPermissions get(String name, Output<String> id, EnterpriseActionsWorkflowPermissionsState state, CustomResourceOptions options)resources: _: type: github:EnterpriseActionsWorkflowPermissions 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.
- Can
Approve boolPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread. - Enterprise
Slug string - The slug of the enterprise.
- Can
Approve boolPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread. - Enterprise
Slug string - The slug of the enterprise.
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread. - enterprise
Slug String - The slug of the enterprise.
- can
Approve booleanPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread. - enterprise
Slug string - The slug of the enterprise.
- can_
approve_ boolpull_ request_ reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default_
workflow_ strpermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread. - enterprise_
slug str - The slug of the enterprise.
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull request reviews. Defaults to
false. - default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be
readorwrite. Defaults toread. - enterprise
Slug String - The slug of the enterprise.
Import
Enterprise Actions workflow permissions can be imported using the enterprise slug:
$ pulumi import github:index/enterpriseActionsWorkflowPermissions:EnterpriseActionsWorkflowPermissions example my-enterprise
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
githubTerraform Provider.
