-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathinterface.ts
More file actions
111 lines (102 loc) · 2.64 KB
/
Copy pathinterface.ts
File metadata and controls
111 lines (102 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import type {
CommitMessage,
FileChanges,
} from "./github/graphql/generated/types.js";
import type { GitHubClient } from "./github/graphql/queries.js";
import type { Logger } from "./logging.js";
export type CommitFilesResult = {
refId: string | null;
};
export type GitBase =
| {
branch: string;
}
| {
tag: string;
}
| {
commit: string;
};
export interface CommitFilesBasedArgs {
octokit: GitHubClient;
owner: string;
repository: string;
branch: string;
/**
* Push the commit even if the branch exists and does not match what was
* specified as the base.
*/
force?: boolean;
/**
* The commit message
*/
message: CommitMessage;
log?: Logger;
}
export interface CommitFilesSharedArgsWithBase extends CommitFilesBasedArgs {
/**
* The current branch, tag or commit that the new branch should be based on.
*/
base: GitBase;
}
export interface CommitFilesFromBase64Args
extends CommitFilesSharedArgsWithBase {
fileChanges: FileChanges;
}
export interface CommitFilesFromBuffersArgs
extends CommitFilesSharedArgsWithBase {
/**
* The file changes, relative to the repository root, to make to the specified branch.
*/
fileChanges: {
additions?: Array<{
path: string;
contents: Buffer;
}>;
deletions?: string[];
};
}
export interface CommitFilesFromDirectoryArgs
extends CommitFilesSharedArgsWithBase {
/**
* The directory to consider the root of the repository when calculating
* file paths
*/
workingDirectory?: string;
/**
* The file paths, relative to {@link workingDirectory},
* to add or delete from the branch on GitHub.
*/
fileChanges: {
/** File paths, relative to {@link workingDirectory}, to remove from the repo. */
additions?: string[];
/** File paths, relative to the repository root, to remove from the repo. */
deletions?: string[];
};
}
export interface CommitChangesFromRepoArgs extends CommitFilesBasedArgs {
/**
* The base commit to build your changes on-top of.
*
* By default, this commit will be the HEAD of the local repository,
* meaning that if any commits have been made locally and not pushed,
* this command will fail.
*
* To include all changes, this should be set to a commit that is known
* to be in the remote repository (such as the default branch).
*
* If you want to base the changes on a different commit to one checked out,
* make sure that you also pull this commit from the remote.
*
* @default HEAD
*/
base?: {
commit: string;
};
/**
* The root of the repository.
*
* @default process.cwd()
*/
repoDirectory?: string;
}