Skip to content

Commit

Permalink
feat: updateRefs mutation (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
octokitbot authored Apr 18, 2024
1 parent e2dc3b1 commit 577dd44
Show file tree
Hide file tree
Showing 3 changed files with 321 additions and 0 deletions.
58 changes: 58 additions & 0 deletions schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export type Scalars = {
DateTime: { input: any; output: any; }
/** A Git object ID. */
GitObjectID: { input: any; output: any; }
/** A fully qualified reference name (e.g. `refs/heads/master`). */
GitRefname: { input: any; output: any; }
/** Git SSH string */
GitSSHRemote: { input: any; output: any; }
/** An ISO-8601 encoded date string. Unlike the DateTime type, GitTimestamp is not converted in UTC. */
Expand Down Expand Up @@ -11428,6 +11430,27 @@ export type Mutation = {
updatePullRequestReviewComment?: Maybe<UpdatePullRequestReviewCommentPayload>;
/** Update a Git Ref. */
updateRef?: Maybe<UpdateRefPayload>;
/**
* Creates, updates and/or deletes multiple refs in a repository.
*
* This mutation takes a list of `RefUpdate`s and performs these updates
* on the repository. All updates are performed atomically, meaning that
* if one of them is rejected, no other ref will be modified.
*
* `RefUpdate.beforeOid` specifies that the given reference needs to point
* to the given value before performing any updates. A value of
* `0000000000000000000000000000000000000000` can be used to verify that
* the references should not exist.
*
* `RefUpdate.afterOid` specifies the value that the given reference
* will point to after performing all updates. A value of
* `0000000000000000000000000000000000000000` can be used to delete a
* reference.
*
* If `RefUpdate.force` is set to `true`, a non-fast-forward updates
* for the given reference will be allowed.
*/
updateRefs?: Maybe<UpdateRefsPayload>;
/** Update information about a repository. */
updateRepository?: Maybe<UpdateRepositoryPayload>;
/** Update a repository ruleset */
Expand Down Expand Up @@ -12759,6 +12782,12 @@ export type MutationUpdateRefArgs = {
};


/** The root query for implementing GraphQL mutations. */
export type MutationUpdateRefsArgs = {
input: UpdateRefsInput;
};


/** The root query for implementing GraphQL mutations. */
export type MutationUpdateRepositoryArgs = {
input: UpdateRepositoryInput;
Expand Down Expand Up @@ -19696,6 +19725,18 @@ export type RefOrderField =
/** Order refs by underlying commit date if the ref prefix is refs/tags/ */
| 'TAG_COMMIT_DATE';

/** A ref update */
export type RefUpdate = {
/** The value this ref should be updated to. */
afterOid: Scalars['GitObjectID']['input'];
/** The value this ref needs to point to before the update. */
beforeOid?: InputMaybe<Scalars['GitObjectID']['input']>;
/** Force a non fast-forward update. */
force?: InputMaybe<Scalars['Boolean']['input']>;
/** The fully qualified name of the ref to be update. For example `refs/heads/branch-name` */
name: Scalars['GitRefname']['input'];
};

/** Branch protection rules that are enforced on the viewer. */
export type RefUpdateRule = {
__typename?: 'RefUpdateRule';
Expand Down Expand Up @@ -28830,6 +28871,23 @@ export type UpdateRefPayload = {
ref?: Maybe<Ref>;
};

/** Autogenerated input type of UpdateRefs */
export type UpdateRefsInput = {
/** A unique identifier for the client performing the mutation. */
clientMutationId?: InputMaybe<Scalars['String']['input']>;
/** A list of ref updates. */
refUpdates: Array<RefUpdate>;
/** The Node ID of the repository. */
repositoryId: Scalars['ID']['input'];
};

/** Autogenerated return type of UpdateRefs */
export type UpdateRefsPayload = {
__typename?: 'UpdateRefsPayload';
/** A unique identifier for the client performing the mutation. */
clientMutationId?: Maybe<Scalars['String']['output']>;
};

/** Autogenerated input type of UpdateRepository */
export type UpdateRepositoryInput = {
/** A unique identifier for the client performing the mutation. */
Expand Down
87 changes: 87 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -16485,6 +16485,11 @@ A Git object ID.
"""
scalar GitObjectID

"""
A fully qualified reference name (e.g. `refs/heads/master`).
"""
scalar GitRefname

"""
Git SSH string
"""
Expand Down Expand Up @@ -23959,6 +23964,33 @@ type Mutation {
input: UpdateRefInput!
): UpdateRefPayload

"""
Creates, updates and/or deletes multiple refs in a repository.

This mutation takes a list of `RefUpdate`s and performs these updates
on the repository. All updates are performed atomically, meaning that
if one of them is rejected, no other ref will be modified.

`RefUpdate.beforeOid` specifies that the given reference needs to point
to the given value before performing any updates. A value of
`0000000000000000000000000000000000000000` can be used to verify that
the references should not exist.

`RefUpdate.afterOid` specifies the value that the given reference
will point to after performing all updates. A value of
`0000000000000000000000000000000000000000` can be used to delete a
reference.

If `RefUpdate.force` is set to `true`, a non-fast-forward updates
for the given reference will be allowed.
"""
updateRefs(
"""
Parameters for UpdateRefs
"""
input: UpdateRefsInput!
): UpdateRefsPayload

"""
Update information about a repository.
"""
Expand Down Expand Up @@ -38976,6 +39008,31 @@ enum RefOrderField {
TAG_COMMIT_DATE
}

"""
A ref update
"""
input RefUpdate {
"""
The value this ref should be updated to.
"""
afterOid: GitObjectID!

"""
The value this ref needs to point to before the update.
"""
beforeOid: GitObjectID

"""
Force a non fast-forward update.
"""
force: Boolean = false

"""
The fully qualified name of the ref to be update. For example `refs/heads/branch-name`
"""
name: GitRefname!
}

"""
Branch protection rules that are enforced on the viewer.
"""
Expand Down Expand Up @@ -58077,6 +58134,36 @@ type UpdateRefPayload {
ref: Ref
}

"""
Autogenerated input type of UpdateRefs
"""
input UpdateRefsInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String

"""
A list of ref updates.
"""
refUpdates: [RefUpdate!]!

"""
The Node ID of the repository.
"""
repositoryId: ID!
}

"""
Autogenerated return type of UpdateRefs
"""
type UpdateRefsPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
}

"""
Autogenerated input type of UpdateRepository
"""
Expand Down
Loading

0 comments on commit 577dd44

Please sign in to comment.