Skip to content

Commit

Permalink
feat: support workflows in repository rules (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
octokitbot authored Oct 11, 2023
1 parent 3ff791e commit 2b4b713
Show file tree
Hide file tree
Showing 3 changed files with 339 additions and 2 deletions.
44 changes: 43 additions & 1 deletion schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21958,6 +21958,8 @@ export type RepositoryRuleType =
| 'TAG_NAME_PATTERN'
/** Only allow users with bypass permission to update matching refs. */
| 'UPDATE'
/** Require all changes made to a targeted branch to pass the specified workflows before they can be merged. */
| 'WORKFLOWS'
/** Workflow files cannot be modified. */
| 'WORKFLOW_UPDATES';

Expand Down Expand Up @@ -22768,7 +22770,7 @@ export type RuleEnforcement =
| 'EVALUATE';

/** Types which can be parameters for `RepositoryRule` objects. */
export type RuleParameters = BranchNamePatternParameters | CommitAuthorEmailPatternParameters | CommitMessagePatternParameters | CommitterEmailPatternParameters | PullRequestParameters | RequiredDeploymentsParameters | RequiredStatusChecksParameters | TagNamePatternParameters | UpdateParameters;
export type RuleParameters = BranchNamePatternParameters | CommitAuthorEmailPatternParameters | CommitMessagePatternParameters | CommitterEmailPatternParameters | PullRequestParameters | RequiredDeploymentsParameters | RequiredStatusChecksParameters | TagNamePatternParameters | UpdateParameters | WorkflowsParameters;

/** Specifies the parameters for a `RepositoryRule` object. Only one of the fields should be specified. */
export type RuleParametersInput = {
Expand All @@ -22790,6 +22792,8 @@ export type RuleParametersInput = {
tagNamePattern?: InputMaybe<TagNamePatternParametersInput>;
/** Parameters used for the `update` rule type */
update?: InputMaybe<UpdateParametersInput>;
/** Parameters used for the `workflows` rule type */
workflows?: InputMaybe<WorkflowsParametersInput>;
};

/** Types which can have `RepositoryRule` objects. */
Expand Down Expand Up @@ -28946,6 +28950,31 @@ export type WorkflowRunsArgs = {
orderBy?: InputMaybe<WorkflowRunOrder>;
};

/** A workflow that must run for this rule to pass */
export type WorkflowFileReference = {
__typename?: 'WorkflowFileReference';
/** The path to the workflow file */
path: Scalars['String']['output'];
/** The ref (branch or tag) of the workflow file to use */
ref?: Maybe<Scalars['String']['output']>;
/** The ID of the repository where the workflow is defined */
repositoryId: Scalars['Int']['output'];
/** The commit SHA of the workflow file to use */
sha?: Maybe<Scalars['String']['output']>;
};

/** A workflow that must run for this rule to pass */
export type WorkflowFileReferenceInput = {
/** The path to the workflow file */
path: Scalars['String']['input'];
/** The ref (branch or tag) of the workflow file to use */
ref?: InputMaybe<Scalars['String']['input']>;
/** The ID of the repository where the workflow is defined */
repositoryId: Scalars['Int']['input'];
/** The commit SHA of the workflow file to use */
sha?: InputMaybe<Scalars['String']['input']>;
};

/** A workflow run. */
export type WorkflowRun = Node & UniformResourceLocatable & {
__typename?: 'WorkflowRun';
Expand Down Expand Up @@ -29063,3 +29092,16 @@ export type WorkflowState =
| 'DISABLED_INACTIVITY'
/** The workflow was disabled manually. */
| 'DISABLED_MANUALLY';

/** Require all changes made to a targeted branch to pass the specified workflows before they can be merged. */
export type WorkflowsParameters = {
__typename?: 'WorkflowsParameters';
/** Workflows that must pass for this rule to pass. */
workflows: Array<WorkflowFileReference>;
};

/** Require all changes made to a targeted branch to pass the specified workflows before they can be merged. */
export type WorkflowsParametersInput = {
/** Workflows that must pass for this rule to pass. */
workflows: Array<WorkflowFileReferenceInput>;
};
82 changes: 81 additions & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -43884,6 +43884,11 @@ enum RepositoryRuleType {
"""
UPDATE

"""
Require all changes made to a targeted branch to pass the specified workflows before they can be merged.
"""
WORKFLOWS

"""
Workflow files cannot be modified.
"""
Expand Down Expand Up @@ -45447,7 +45452,7 @@ enum RuleEnforcement {
"""
Types which can be parameters for `RepositoryRule` objects.
"""
union RuleParameters = BranchNamePatternParameters | CommitAuthorEmailPatternParameters | CommitMessagePatternParameters | CommitterEmailPatternParameters | PullRequestParameters | RequiredDeploymentsParameters | RequiredStatusChecksParameters | TagNamePatternParameters | UpdateParameters
union RuleParameters = BranchNamePatternParameters | CommitAuthorEmailPatternParameters | CommitMessagePatternParameters | CommitterEmailPatternParameters | PullRequestParameters | RequiredDeploymentsParameters | RequiredStatusChecksParameters | TagNamePatternParameters | UpdateParameters | WorkflowsParameters

"""
Specifies the parameters for a `RepositoryRule` object. Only one of the fields should be specified.
Expand Down Expand Up @@ -45497,6 +45502,11 @@ input RuleParametersInput {
Parameters used for the `update` rule type
"""
update: UpdateParametersInput

"""
Parameters used for the `workflows` rule type
"""
workflows: WorkflowsParametersInput
}

"""
Expand Down Expand Up @@ -58252,6 +58262,56 @@ type Workflow implements Node & UniformResourceLocatable {
url: URI!
}

"""
A workflow that must run for this rule to pass
"""
type WorkflowFileReference {
"""
The path to the workflow file
"""
path: String!

"""
The ref (branch or tag) of the workflow file to use
"""
ref: String

"""
The ID of the repository where the workflow is defined
"""
repositoryId: Int!

"""
The commit SHA of the workflow file to use
"""
sha: String
}

"""
A workflow that must run for this rule to pass
"""
input WorkflowFileReferenceInput {
"""
The path to the workflow file
"""
path: String!

"""
The ref (branch or tag) of the workflow file to use
"""
ref: String

"""
The ID of the repository where the workflow is defined
"""
repositoryId: Int!

"""
The commit SHA of the workflow file to use
"""
sha: String
}

"""
A workflow run.
"""
Expand Down Expand Up @@ -58500,6 +58560,26 @@ enum WorkflowState {
DISABLED_MANUALLY
}

"""
Require all changes made to a targeted branch to pass the specified workflows before they can be merged.
"""
type WorkflowsParameters {
"""
Workflows that must pass for this rule to pass.
"""
workflows: [WorkflowFileReference!]!
}

"""
Require all changes made to a targeted branch to pass the specified workflows before they can be merged.
"""
input WorkflowsParametersInput {
"""
Workflows that must pass for this rule to pass.
"""
workflows: [WorkflowFileReferenceInput!]!
}

"""
A valid x509 certificate string
"""
Expand Down
Loading

0 comments on commit 2b4b713

Please sign in to comment.