1
- import { GitHub } from "@actions/github/lib/utils" ;
1
+ import type { GitHub } from "@actions/github/lib/utils" ;
2
2
3
3
export type GitHubClient = InstanceType < typeof GitHub > ;
4
4
5
- import {
5
+ import type {
6
6
CreateCommitOnBranchMutation ,
7
7
CreateCommitOnBranchMutationVariables ,
8
8
CreateRefMutation ,
9
9
CreateRefMutationVariables ,
10
+ DeleteRefMutation ,
11
+ DeleteRefMutationVariables ,
10
12
GetRepositoryMetadataQuery ,
11
13
GetRepositoryMetadataQueryVariables ,
12
14
} from "./generated/operations" ;
@@ -16,6 +18,7 @@ const GET_REPOSITORY_METADATA = /* GraphQL */ `
16
18
repository(owner: $owner, name: $name) {
17
19
id
18
20
ref(qualifiedName: $ref) {
21
+ id
19
22
target {
20
23
oid
21
24
}
@@ -34,6 +37,14 @@ const CREATE_REF = /* GraphQL */ `
34
37
}
35
38
` ;
36
39
40
+ const DELETE_REF = /* GraphQL */ `
41
+ mutation deleteRef($input: DeleteRefInput!) {
42
+ deleteRef(input: $input) {
43
+ clientMutationId
44
+ }
45
+ }
46
+ ` ;
47
+
37
48
const CREATE_COMMIT_ON_BRANCH = /* GraphQL */ `
38
49
mutation createCommitOnBranch($input: CreateCommitOnBranchInput!) {
39
50
createCommitOnBranch(input: $input) {
@@ -44,12 +55,6 @@ const CREATE_COMMIT_ON_BRANCH = /* GraphQL */ `
44
55
}
45
56
` ;
46
57
47
- export const createCommitOnBranchQuery = async (
48
- o : GitHubClient ,
49
- v : CreateCommitOnBranchMutationVariables ,
50
- ) : Promise < CreateCommitOnBranchMutation > =>
51
- o . graphql < CreateCommitOnBranchMutation > ( CREATE_COMMIT_ON_BRANCH , v ) ;
52
-
53
58
export const getRepositoryMetadata = async (
54
59
o : GitHubClient ,
55
60
v : GetRepositoryMetadataQueryVariables ,
@@ -66,3 +71,15 @@ export const createRefMutation = async (
66
71
v : CreateRefMutationVariables ,
67
72
) : Promise < CreateRefMutation > =>
68
73
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