This resource allows you to manage GitHub Actions workflow permissions for a GitHub Organization 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 organization 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.ActionsOrganizationWorkflowPermissions("example", {
organizationSlug: "my-organization",
defaultWorkflowPermissions: "read",
canApprovePullRequestReviews: false,
});
// Allow write permissions and PR approvals
const permissive = new github.ActionsOrganizationWorkflowPermissions("permissive", {
organizationSlug: "my-organization",
defaultWorkflowPermissions: "write",
canApprovePullRequestReviews: true,
});
import pulumi
import pulumi_github as github
# Basic workflow permissions configuration
example = github.ActionsOrganizationWorkflowPermissions("example",
organization_slug="my-organization",
default_workflow_permissions="read",
can_approve_pull_request_reviews=False)
# Allow write permissions and PR approvals
permissive = github.ActionsOrganizationWorkflowPermissions("permissive",
organization_slug="my-organization",
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.NewActionsOrganizationWorkflowPermissions(ctx, "example", &github.ActionsOrganizationWorkflowPermissionsArgs{
OrganizationSlug: pulumi.String("my-organization"),
DefaultWorkflowPermissions: pulumi.String("read"),
CanApprovePullRequestReviews: pulumi.Bool(false),
})
if err != nil {
return err
}
// Allow write permissions and PR approvals
_, err = github.NewActionsOrganizationWorkflowPermissions(ctx, "permissive", &github.ActionsOrganizationWorkflowPermissionsArgs{
OrganizationSlug: pulumi.String("my-organization"),
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.ActionsOrganizationWorkflowPermissions("example", new()
{
OrganizationSlug = "my-organization",
DefaultWorkflowPermissions = "read",
CanApprovePullRequestReviews = false,
});
// Allow write permissions and PR approvals
var permissive = new Github.ActionsOrganizationWorkflowPermissions("permissive", new()
{
OrganizationSlug = "my-organization",
DefaultWorkflowPermissions = "write",
CanApprovePullRequestReviews = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.ActionsOrganizationWorkflowPermissions;
import com.pulumi.github.ActionsOrganizationWorkflowPermissionsArgs;
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 ActionsOrganizationWorkflowPermissions("example", ActionsOrganizationWorkflowPermissionsArgs.builder()
.organizationSlug("my-organization")
.defaultWorkflowPermissions("read")
.canApprovePullRequestReviews(false)
.build());
// Allow write permissions and PR approvals
var permissive = new ActionsOrganizationWorkflowPermissions("permissive", ActionsOrganizationWorkflowPermissionsArgs.builder()
.organizationSlug("my-organization")
.defaultWorkflowPermissions("write")
.canApprovePullRequestReviews(true)
.build());
}
}
resources:
# Basic workflow permissions configuration
example:
type: github:ActionsOrganizationWorkflowPermissions
properties:
organizationSlug: my-organization
defaultWorkflowPermissions: read
canApprovePullRequestReviews: false
# Allow write permissions and PR approvals
permissive:
type: github:ActionsOrganizationWorkflowPermissions
properties:
organizationSlug: my-organization
defaultWorkflowPermissions: write
canApprovePullRequestReviews: true
Notes
Note: This resource requires a GitHub Organization account and organization 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 ActionsOrganizationWorkflowPermissions Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ActionsOrganizationWorkflowPermissions(name: string, args: ActionsOrganizationWorkflowPermissionsArgs, opts?: CustomResourceOptions);@overload
def ActionsOrganizationWorkflowPermissions(resource_name: str,
args: ActionsOrganizationWorkflowPermissionsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ActionsOrganizationWorkflowPermissions(resource_name: str,
opts: Optional[ResourceOptions] = None,
organization_slug: Optional[str] = None,
can_approve_pull_request_reviews: Optional[bool] = None,
default_workflow_permissions: Optional[str] = None)func NewActionsOrganizationWorkflowPermissions(ctx *Context, name string, args ActionsOrganizationWorkflowPermissionsArgs, opts ...ResourceOption) (*ActionsOrganizationWorkflowPermissions, error)public ActionsOrganizationWorkflowPermissions(string name, ActionsOrganizationWorkflowPermissionsArgs args, CustomResourceOptions? opts = null)
public ActionsOrganizationWorkflowPermissions(String name, ActionsOrganizationWorkflowPermissionsArgs args)
public ActionsOrganizationWorkflowPermissions(String name, ActionsOrganizationWorkflowPermissionsArgs args, CustomResourceOptions options)
type: github:ActionsOrganizationWorkflowPermissions
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 ActionsOrganizationWorkflowPermissionsArgs
- 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 ActionsOrganizationWorkflowPermissionsArgs
- 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 ActionsOrganizationWorkflowPermissionsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ActionsOrganizationWorkflowPermissionsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ActionsOrganizationWorkflowPermissionsArgs
- 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 actionsOrganizationWorkflowPermissionsResource = new Github.ActionsOrganizationWorkflowPermissions("actionsOrganizationWorkflowPermissionsResource", new()
{
OrganizationSlug = "string",
CanApprovePullRequestReviews = false,
DefaultWorkflowPermissions = "string",
});
example, err := github.NewActionsOrganizationWorkflowPermissions(ctx, "actionsOrganizationWorkflowPermissionsResource", &github.ActionsOrganizationWorkflowPermissionsArgs{
OrganizationSlug: pulumi.String("string"),
CanApprovePullRequestReviews: pulumi.Bool(false),
DefaultWorkflowPermissions: pulumi.String("string"),
})
var actionsOrganizationWorkflowPermissionsResource = new ActionsOrganizationWorkflowPermissions("actionsOrganizationWorkflowPermissionsResource", ActionsOrganizationWorkflowPermissionsArgs.builder()
.organizationSlug("string")
.canApprovePullRequestReviews(false)
.defaultWorkflowPermissions("string")
.build());
actions_organization_workflow_permissions_resource = github.ActionsOrganizationWorkflowPermissions("actionsOrganizationWorkflowPermissionsResource",
organization_slug="string",
can_approve_pull_request_reviews=False,
default_workflow_permissions="string")
const actionsOrganizationWorkflowPermissionsResource = new github.ActionsOrganizationWorkflowPermissions("actionsOrganizationWorkflowPermissionsResource", {
organizationSlug: "string",
canApprovePullRequestReviews: false,
defaultWorkflowPermissions: "string",
});
type: github:ActionsOrganizationWorkflowPermissions
properties:
canApprovePullRequestReviews: false
defaultWorkflowPermissions: string
organizationSlug: string
ActionsOrganizationWorkflowPermissions 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 ActionsOrganizationWorkflowPermissions resource accepts the following input properties:
- Organization
Slug string - The slug of the organization.
- 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.
- Organization
Slug string - The slug of the organization.
- 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.
- organization
Slug String - The slug of the organization.
- 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.
- organization
Slug string - The slug of the organization.
- 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.
- organization_
slug str - The slug of the organization.
- 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.
- organization
Slug String - The slug of the organization.
- 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 ActionsOrganizationWorkflowPermissions 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 ActionsOrganizationWorkflowPermissions Resource
Get an existing ActionsOrganizationWorkflowPermissions 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?: ActionsOrganizationWorkflowPermissionsState, opts?: CustomResourceOptions): ActionsOrganizationWorkflowPermissions@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,
organization_slug: Optional[str] = None) -> ActionsOrganizationWorkflowPermissionsfunc GetActionsOrganizationWorkflowPermissions(ctx *Context, name string, id IDInput, state *ActionsOrganizationWorkflowPermissionsState, opts ...ResourceOption) (*ActionsOrganizationWorkflowPermissions, error)public static ActionsOrganizationWorkflowPermissions Get(string name, Input<string> id, ActionsOrganizationWorkflowPermissionsState? state, CustomResourceOptions? opts = null)public static ActionsOrganizationWorkflowPermissions get(String name, Output<String> id, ActionsOrganizationWorkflowPermissionsState state, CustomResourceOptions options)resources: _: type: github:ActionsOrganizationWorkflowPermissions 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. - Organization
Slug string - The slug of the organization.
- 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. - Organization
Slug string - The slug of the organization.
- 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. - organization
Slug String - The slug of the organization.
- 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. - organization
Slug string - The slug of the organization.
- 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. - organization_
slug str - The slug of the organization.
- 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. - organization
Slug String - The slug of the organization.
Import
Organization Actions workflow permissions can be imported using the organization slug:
$ pulumi import github:index/actionsOrganizationWorkflowPermissions:ActionsOrganizationWorkflowPermissions example my-organization
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.
