Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

160 linesCodeBlameRaw
1/**
2 * Dependency updates: the file that asks for them, written in
3 * `dependabot.yml` (version 2) syntax, and the pull requests g1t opens from
4 * it. Mirrors `g1t_contracts::updates`.
5 */
6
7/** Where the dependency update file may be, in the order it is looked for. */
8export const DEPENDABOT_PATHS = [".g1t/dependabot.yml", ".g1t/dependabot.yaml", ".github/dependabot.yml", ".github/dependabot.yaml"] as const;
9
10/** The status a pull request that changes the file gets on its head. */
11export const DEPENDABOT_CHECK = "g1t / dependabot.yml";
12
13/** One thing wrong with the dependency update file, and where. */
14export type ConfigProblem = {
15 /** 1-based; 0 when the problem is with the file as a whole. */
16 line: number;
17 column: number;
18 /** The key it is about: `updates[0].schedule.interval`. */
19 key: string;
20 message: string;
21};
22
23/** A `groups` rule. */
24export type UpdateGroup = {
25 name: string;
26 /** `version-updates` or `security-updates`. */
27 appliesTo: string;
28 patterns: string[];
29 excludePatterns: string[];
30 /** `major`, `minor`, `patch`; every one when empty. */
31 updateTypes: string[];
32 dependencyType: string | null;
33 groupBy: string | null;
34};
35
36/** An `ignore` rule. */
37export type UpdateIgnore = {
38 dependency: string;
39 versions: string[];
40 updateTypes: string[];
41};
42
43/** An `allow` rule. */
44export type UpdateAllow = {
45 dependency: string | null;
46 dependencyType: string | null;
47 updateTypes: string[];
48};
49
50/** One entry of the file's `updates`, and where its version updates stand. */
51export type VersionUpdateEntry = {
52 /** What "Check for updates" names. */
53 id: string;
54 /** `package-ecosystem`, as written. */
55 ecosystem: string;
56 directories: string[];
57 /** Whether g1t opens version update pull requests for this ecosystem. */
58 supported: boolean;
59 interval: string;
60 /** The schedule in words: "Weekdays at 05:00 (UTC)". */
61 schedule: string;
62 openPullRequestsLimit: number;
63 targetBranch: string | null;
64 multiEcosystemGroup: string | null;
65 groups: UpdateGroup[];
66 ignore: UpdateIgnore[];
67 allow: UpdateAllow[];
68 /** Null for the default labels; empty for none. */
69 labels: string[] | null;
70 assignees: string[];
71 reviewers: string[];
72 milestone: number | null;
73 versioningStrategy: string | null;
74 /** The entry as read, with the file's own key names. */
75 options: Record<string, unknown>;
76 /** Options g1t reads but does not act on, each with why. */
77 notes: string[];
78 nextRunAt: string | null;
79 lastCheckedAt: string | null;
80 lastResult: string | null;
81 lastError: string | null;
82};
83
84/** A private registry from the file, without its credentials. */
85export type UpdateRegistry = {
86 name: string;
87 kind: string;
88 url: string;
89 /** The secrets its credentials name. */
90 secrets: string[];
91};
92
93/** One dependency an update pull request raises. */
94export type UpdatedDependency = {
95 name: string;
96 from: string;
97 to: string;
98 directory: string;
99 dependencyType: string;
100 updateType: string;
101};
102
103/** A pull request g1t opened, or is making, to update dependencies. */
104export type UpdatePull = {
105 kind: "version" | "security";
106 entry: string;
107 ecosystem: string;
108 group: string | null;
109 branch: string;
110 title: string;
111 state: "requested" | "open" | "merged" | "closed" | "superseded" | "needs_code" | "failed";
112 pull: number | null;
113 dependencies: UpdatedDependency[];
114 mergeRequestedBy: string | null;
115 error: string | null;
116 updatedAt: string;
117};
118
119/** A dependency, or some of its versions, skipped because someone said so in a comment. */
120export type IgnoreCondition = {
121 ecosystem: string;
122 dependency: string;
123 versions: string | null;
124 updateType: string | null;
125 by: string;
126 pull: number | null;
127 at: string;
128};
129
130/** What the dependency update file asks for, as last read from the default branch. */
131export type VersionUpdatesState = {
132 found: boolean;
133 /** The file read. */
134 path: string | null;
135 /** Other dependency update files, not read because `path` comes first. */
136 ignoredPaths: string[];
137 /** The first problem, as a sentence. */
138 error: string | null;
139 problems: ConfigProblem[];
140 updates: VersionUpdateEntry[];
141 registries: UpdateRegistry[];
142 readAt: string | null;
143 commit: string | null;
144 pulls: UpdatePull[];
145 ignores: IgnoreCondition[];
146};
147
148/** One package of a grouped `bump`. */
149export type BumpPackage = { package: string; version: string };
150
151/** A private registry a `bump` sandbox's tools may read, with its credentials. */
152export type BumpRegistry = {
153 type: string;
154 url: string;
155 username?: string;
156 password?: string;
157 token?: string;
158 replacesBase?: boolean;
159 scopes?: string[];
160};