This resource allows you to manage GitHub Workflow permissions for a given repository. You must have admin access to a repository to use this resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = new github.Repository("example", {name: "my-repository"});
const test = new github.WorkflowRepositoryPermissions("test", {
defaultWorkflowPermissions: "read",
canApprovePullRequestReviews: true,
repository: example.name,
});
import pulumi
import pulumi_github as github
example = github.Repository("example", name="my-repository")
test = github.WorkflowRepositoryPermissions("test",
default_workflow_permissions="read",
can_approve_pull_request_reviews=True,
repository=example.name)
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 {
example, err := github.NewRepository(ctx, "example", &github.RepositoryArgs{
Name: pulumi.String("my-repository"),
})
if err != nil {
return err
}
_, err = github.NewWorkflowRepositoryPermissions(ctx, "test", &github.WorkflowRepositoryPermissionsArgs{
DefaultWorkflowPermissions: pulumi.String("read"),
CanApprovePullRequestReviews: pulumi.Bool(true),
Repository: example.Name,
})
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 example = new Github.Repository("example", new()
{
Name = "my-repository",
});
var test = new Github.WorkflowRepositoryPermissions("test", new()
{
DefaultWorkflowPermissions = "read",
CanApprovePullRequestReviews = true,
Repository = example.Name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.WorkflowRepositoryPermissions;
import com.pulumi.github.WorkflowRepositoryPermissionsArgs;
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 example = new Repository("example", RepositoryArgs.builder()
.name("my-repository")
.build());
var test = new WorkflowRepositoryPermissions("test", WorkflowRepositoryPermissionsArgs.builder()
.defaultWorkflowPermissions("read")
.canApprovePullRequestReviews(true)
.repository(example.name())
.build());
}
}
resources:
example:
type: github:Repository
properties:
name: my-repository
test:
type: github:WorkflowRepositoryPermissions
properties:
defaultWorkflowPermissions: read
canApprovePullRequestReviews: true
repository: ${example.name}
Create WorkflowRepositoryPermissions Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new WorkflowRepositoryPermissions(name: string, args: WorkflowRepositoryPermissionsArgs, opts?: CustomResourceOptions);@overload
def WorkflowRepositoryPermissions(resource_name: str,
args: WorkflowRepositoryPermissionsArgs,
opts: Optional[ResourceOptions] = None)
@overload
def WorkflowRepositoryPermissions(resource_name: str,
opts: Optional[ResourceOptions] = None,
repository: Optional[str] = None,
can_approve_pull_request_reviews: Optional[bool] = None,
default_workflow_permissions: Optional[str] = None)func NewWorkflowRepositoryPermissions(ctx *Context, name string, args WorkflowRepositoryPermissionsArgs, opts ...ResourceOption) (*WorkflowRepositoryPermissions, error)public WorkflowRepositoryPermissions(string name, WorkflowRepositoryPermissionsArgs args, CustomResourceOptions? opts = null)
public WorkflowRepositoryPermissions(String name, WorkflowRepositoryPermissionsArgs args)
public WorkflowRepositoryPermissions(String name, WorkflowRepositoryPermissionsArgs args, CustomResourceOptions options)
type: github:WorkflowRepositoryPermissions
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 WorkflowRepositoryPermissionsArgs
- 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 WorkflowRepositoryPermissionsArgs
- 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 WorkflowRepositoryPermissionsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args WorkflowRepositoryPermissionsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args WorkflowRepositoryPermissionsArgs
- 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 workflowRepositoryPermissionsResource = new Github.WorkflowRepositoryPermissions("workflowRepositoryPermissionsResource", new()
{
Repository = "string",
CanApprovePullRequestReviews = false,
DefaultWorkflowPermissions = "string",
});
example, err := github.NewWorkflowRepositoryPermissions(ctx, "workflowRepositoryPermissionsResource", &github.WorkflowRepositoryPermissionsArgs{
Repository: pulumi.String("string"),
CanApprovePullRequestReviews: pulumi.Bool(false),
DefaultWorkflowPermissions: pulumi.String("string"),
})
var workflowRepositoryPermissionsResource = new WorkflowRepositoryPermissions("workflowRepositoryPermissionsResource", WorkflowRepositoryPermissionsArgs.builder()
.repository("string")
.canApprovePullRequestReviews(false)
.defaultWorkflowPermissions("string")
.build());
workflow_repository_permissions_resource = github.WorkflowRepositoryPermissions("workflowRepositoryPermissionsResource",
repository="string",
can_approve_pull_request_reviews=False,
default_workflow_permissions="string")
const workflowRepositoryPermissionsResource = new github.WorkflowRepositoryPermissions("workflowRepositoryPermissionsResource", {
repository: "string",
canApprovePullRequestReviews: false,
defaultWorkflowPermissions: "string",
});
type: github:WorkflowRepositoryPermissions
properties:
canApprovePullRequestReviews: false
defaultWorkflowPermissions: string
repository: string
WorkflowRepositoryPermissions 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 WorkflowRepositoryPermissions resource accepts the following input properties:
- Repository string
- The GitHub repository
- Can
Approve boolPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite.
- Repository string
- The GitHub repository
- Can
Approve boolPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite.
- repository String
- The GitHub repository
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite.
- repository string
- The GitHub repository
- can
Approve booleanPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite.
- repository str
- The GitHub repository
- can_
approve_ boolpull_ request_ reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default_
workflow_ strpermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite.
- repository String
- The GitHub repository
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite.
Outputs
All input properties are implicitly available as output properties. Additionally, the WorkflowRepositoryPermissions 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 WorkflowRepositoryPermissions Resource
Get an existing WorkflowRepositoryPermissions 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?: WorkflowRepositoryPermissionsState, opts?: CustomResourceOptions): WorkflowRepositoryPermissions@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,
repository: Optional[str] = None) -> WorkflowRepositoryPermissionsfunc GetWorkflowRepositoryPermissions(ctx *Context, name string, id IDInput, state *WorkflowRepositoryPermissionsState, opts ...ResourceOption) (*WorkflowRepositoryPermissions, error)public static WorkflowRepositoryPermissions Get(string name, Input<string> id, WorkflowRepositoryPermissionsState? state, CustomResourceOptions? opts = null)public static WorkflowRepositoryPermissions get(String name, Output<String> id, WorkflowRepositoryPermissionsState state, CustomResourceOptions options)resources: _: type: github:WorkflowRepositoryPermissions 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 requests. Enabling this can be a security risk.
- Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite. - Repository string
- The GitHub repository
- Can
Approve boolPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- Default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite. - Repository string
- The GitHub repository
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite. - repository String
- The GitHub repository
- can
Approve booleanPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default
Workflow stringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite. - repository string
- The GitHub repository
- can_
approve_ boolpull_ request_ reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default_
workflow_ strpermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite. - repository str
- The GitHub repository
- can
Approve BooleanPull Request Reviews - Whether GitHub Actions can approve pull requests. Enabling this can be a security risk.
- default
Workflow StringPermissions - The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of:
readorwrite. - repository String
- The GitHub repository
Import
This resource can be imported using the name of the GitHub repository:
$ pulumi import github:index/workflowRepositoryPermissions:WorkflowRepositoryPermissions test my-repository
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.
