1- import { GitHub } from "@actions/github/lib/utils" ;
1+ import type { GitHub } from "@actions/github/lib/utils" ;
22
33export type GitHubClient = InstanceType < typeof GitHub > ;
44
5- import {
5+ import type {
66 CreateCommitOnBranchMutation ,
77 CreateCommitOnBranchMutationVariables ,
88 CreateRefMutation ,
99 CreateRefMutationVariables ,
10+ DeleteRefMutation ,
11+ DeleteRefMutationVariables ,
1012 GetRepositoryMetadataQuery ,
1113 GetRepositoryMetadataQueryVariables ,
1214} from "./generated/operations" ;
@@ -16,6 +18,7 @@ const GET_REPOSITORY_METADATA = /* GraphQL */ `
1618 repository(owner: $owner, name: $name) {
1719 id
1820 ref(qualifiedName: $ref) {
21+ id
1922 target {
2023 oid
2124 }
@@ -34,6 +37,14 @@ const CREATE_REF = /* GraphQL */ `
3437 }
3538` ;
3639
40+ const DELETE_REF = /* GraphQL */ `
41+ mutation deleteRef($input: DeleteRefInput!) {
42+ deleteRef(input: $input) {
43+ clientMutationId
44+ }
45+ }
46+ ` ;
47+
3748const CREATE_COMMIT_ON_BRANCH = /* GraphQL */ `
3849 mutation createCommitOnBranch($input: CreateCommitOnBranchInput!) {
3950 createCommitOnBranch(input: $input) {
@@ -44,12 +55,6 @@ const CREATE_COMMIT_ON_BRANCH = /* GraphQL */ `
4455 }
4556` ;
4657
47- export const createCommitOnBranchQuery = async (
48- o : GitHubClient ,
49- v : CreateCommitOnBranchMutationVariables ,
50- ) : Promise < CreateCommitOnBranchMutation > =>
51- o . graphql < CreateCommitOnBranchMutation > ( CREATE_COMMIT_ON_BRANCH , v ) ;
52-
5358export const getRepositoryMetadata = async (
5459 o : GitHubClient ,
5560 v : GetRepositoryMetadataQueryVariables ,
@@ -66,3 +71,15 @@ export const createRefMutation = async (
6671 v : CreateRefMutationVariables ,
6772) : Promise < CreateRefMutation > =>
6873 await o . graphql < CreateRefMutation > ( CREATE_REF , v ) ;
74+
75+ export const deleteRefMutation = async (
76+ o : GitHubClient ,
77+ v : DeleteRefMutationVariables ,
78+ ) : Promise < DeleteRefMutation > =>
79+ await o . graphql < DeleteRefMutation > ( DELETE_REF , v ) ;
80+
81+ export const createCommitOnBranchQuery = async (
82+ o : GitHubClient ,
83+ v : CreateCommitOnBranchMutationVariables ,
84+ ) : Promise < CreateCommitOnBranchMutation > =>
85+ o . graphql < CreateCommitOnBranchMutation > ( CREATE_COMMIT_ON_BRANCH , v ) ;
0 commit comments