renovate 44.84.0 → 44.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/config/presets/forgejo/index.js +3 -2
  2. package/dist/config/presets/forgejo/index.js.map +1 -1
  3. package/dist/config/presets/gitea/index.js +10 -3
  4. package/dist/config/presets/gitea/index.js.map +1 -1
  5. package/dist/constants/error-messages.d.ts +3 -2
  6. package/dist/constants/error-messages.js +3 -1
  7. package/dist/constants/error-messages.js.map +1 -1
  8. package/dist/modules/platform/api.js +6 -6
  9. package/dist/modules/platform/forgejo/index.js +21 -587
  10. package/dist/modules/platform/forgejo/index.js.map +1 -1
  11. package/dist/modules/platform/gitea/gitea-helper.js +90 -74
  12. package/dist/modules/platform/gitea/gitea-helper.js.map +1 -1
  13. package/dist/modules/platform/gitea/index.js +561 -529
  14. package/dist/modules/platform/gitea/index.js.map +1 -1
  15. package/dist/modules/platform/gitea/labels.js +42 -0
  16. package/dist/modules/platform/gitea/labels.js.map +1 -0
  17. package/dist/modules/platform/gitea/pr-cache.js +66 -28
  18. package/dist/modules/platform/gitea/pr-cache.js.map +1 -1
  19. package/dist/modules/platform/gitea/schema.js +141 -5
  20. package/dist/modules/platform/gitea/schema.js.map +1 -1
  21. package/dist/modules/platform/gitea/utils.js +10 -8
  22. package/dist/modules/platform/gitea/utils.js.map +1 -1
  23. package/dist/modules/platform/gitlab/index.js +11 -3
  24. package/dist/modules/platform/gitlab/index.js.map +1 -1
  25. package/dist/util/cache/repository/types.d.ts +13 -8
  26. package/dist/util/http/forgejo.js +6 -35
  27. package/dist/util/http/forgejo.js.map +1 -1
  28. package/dist/workers/repository/error.js +5 -0
  29. package/dist/workers/repository/error.js.map +1 -1
  30. package/dist/workers/repository/process/lookup/index.js +2 -2
  31. package/dist/workers/repository/process/lookup/index.js.map +1 -1
  32. package/dist/workers/repository/update/pr/changelog/forgejo/index.js +1 -1
  33. package/dist/workers/repository/update/pr/changelog/forgejo/index.js.map +1 -1
  34. package/dist/workers/repository/update/pr/changelog/gitea/index.js +3 -3
  35. package/dist/workers/repository/update/pr/changelog/gitea/index.js.map +1 -1
  36. package/package.json +1 -1
  37. package/renovate-schema.json +2 -2
  38. package/dist/modules/platform/forgejo/forgejo-helper.js +0 -235
  39. package/dist/modules/platform/forgejo/forgejo-helper.js.map +0 -1
  40. package/dist/modules/platform/forgejo/pr-cache.js +0 -114
  41. package/dist/modules/platform/forgejo/pr-cache.js.map +0 -1
  42. package/dist/modules/platform/forgejo/schema.js +0 -149
  43. package/dist/modules/platform/forgejo/schema.js.map +0 -1
  44. package/dist/modules/platform/forgejo/utils.js +0 -115
  45. package/dist/modules/platform/forgejo/utils.js.map +0 -1
@@ -1,13 +1,149 @@
1
+ import { fromBase64 } from "../../../util/string.js";
2
+ import { DeepNullish, EmailAddress, LooseArray } from "../../../util/schema-utils/index.js";
3
+ import { LongCommitSha } from "../../../util/schema-utils/git.js";
1
4
  import { z } from "zod/v4";
2
5
  //#region lib/modules/platform/gitea/schema.ts
3
- const ContentsResponse = z.object({
6
+ const ContentsCommon = z.object({
4
7
  name: z.string(),
5
- path: z.string(),
6
- type: z.union([z.literal("file"), z.literal("dir")]),
8
+ path: z.string()
9
+ });
10
+ const ContentsFile = ContentsCommon.extend({
11
+ type: z.literal("file"),
7
12
  content: z.string().nullable()
13
+ }).transform((input) => ({
14
+ ...input,
15
+ contentString: input.content ? fromBase64(input.content) : ""
16
+ }));
17
+ const ContentsDir = ContentsCommon.extend({ type: z.literal("dir") });
18
+ const ContentsSymlink = ContentsCommon.extend({ type: z.literal("symlink") });
19
+ const ContentsSubmodule = ContentsCommon.extend({ type: z.literal("submodule") });
20
+ const RepoContents = z.discriminatedUnion("type", [
21
+ ContentsFile,
22
+ ContentsDir,
23
+ ContentsSymlink,
24
+ ContentsSubmodule
25
+ ]);
26
+ const ContentsListResponse = z.array(RepoContents);
27
+ const User = DeepNullish(z.object({
28
+ id: z.number(),
29
+ email: EmailAddress.optional().catch(void 0),
30
+ full_name: z.string().optional(),
31
+ login: z.string()
32
+ }));
33
+ const RepoPermission = z.object({
34
+ admin: z.boolean(),
35
+ pull: z.boolean(),
36
+ push: z.boolean()
37
+ });
38
+ const PRMergeMethod = z.enum([
39
+ "fast-forward-only",
40
+ "merge",
41
+ "rebase",
42
+ "rebase-merge",
43
+ "squash"
44
+ ]);
45
+ const Repo = DeepNullish(z.object({
46
+ id: z.number(),
47
+ allow_fast_forward_only_merge: z.boolean().default(false),
48
+ allow_merge_commits: z.boolean().default(false),
49
+ allow_rebase: z.boolean().default(false),
50
+ allow_rebase_explicit: z.boolean().default(false),
51
+ allow_squash_merge: z.boolean().default(false),
52
+ archived: z.boolean().optional(),
53
+ clone_url: z.string().optional(),
54
+ default_merge_style: PRMergeMethod.optional().catch(void 0),
55
+ external_tracker: z.unknown().optional(),
56
+ has_issues: z.boolean().optional().default(false),
57
+ has_pull_requests: z.boolean().optional(),
58
+ ssh_url: z.string().optional(),
59
+ default_branch: z.string(),
60
+ empty: z.boolean().optional(),
61
+ fork: z.boolean().optional(),
62
+ full_name: z.string(),
63
+ mirror: z.boolean().optional(),
64
+ owner: User,
65
+ permissions: RepoPermission
66
+ }));
67
+ const Label = DeepNullish(z.object({
68
+ id: z.number(),
69
+ name: z.string(),
70
+ description: z.string().optional(),
71
+ color: z.string().optional()
72
+ }));
73
+ const PRState = z.enum([
74
+ "open",
75
+ "closed",
76
+ "all"
77
+ ]);
78
+ const IssueState = z.enum([
79
+ "open",
80
+ "closed",
81
+ "all"
82
+ ]);
83
+ const PartialRepo = z.object({ full_name: z.string() });
84
+ const PR = DeepNullish(z.object({
85
+ number: z.number(),
86
+ state: PRState,
87
+ title: z.string(),
88
+ body: z.string(),
89
+ mergeable: z.boolean(),
90
+ merged: z.boolean().optional(),
91
+ created_at: z.string(),
92
+ updated_at: z.string(),
93
+ closed_at: z.string().optional(),
94
+ diff_url: z.string().optional(),
95
+ base: z.object({ ref: z.string() }).optional(),
96
+ head: z.object({
97
+ label: z.string(),
98
+ sha: LongCommitSha,
99
+ repo: PartialRepo.optional()
100
+ }).optional(),
101
+ assignee: User.optional(),
102
+ assignees: z.array(User).optional(),
103
+ user: User.optional(),
104
+ labels: z.array(Label).optional()
105
+ }));
106
+ const NullablePR = PR.nullable();
107
+ const PRList = LooseArray(NullablePR);
108
+ const Issue = DeepNullish(z.object({
109
+ number: z.number(),
110
+ state: IssueState.optional(),
111
+ title: z.string(),
112
+ body: z.string(),
113
+ assignees: z.array(User).optional(),
114
+ labels: z.array(Label).optional()
115
+ }));
116
+ const Comment = z.object({
117
+ id: z.number(),
118
+ body: z.string()
119
+ });
120
+ const CommitStatusType = z.enum([
121
+ "pending",
122
+ "success",
123
+ "error",
124
+ "failure",
125
+ "warning",
126
+ "unknown"
127
+ ]).catch("unknown");
128
+ const CommitStatus = DeepNullish(z.object({
129
+ id: z.number(),
130
+ status: CommitStatusType,
131
+ context: z.string(),
132
+ description: z.string().optional(),
133
+ target_url: z.string().optional(),
134
+ created_at: z.string()
135
+ }));
136
+ const Commit = z.object({ id: z.string() });
137
+ z.object({
138
+ name: z.string(),
139
+ commit: Commit
140
+ });
141
+ const RepoSearchResults = z.object({
142
+ ok: z.boolean(),
143
+ data: z.array(Repo)
8
144
  });
9
- const ContentsListResponse = z.array(ContentsResponse);
145
+ const Version = z.object({ version: z.string() });
10
146
  //#endregion
11
- export { ContentsListResponse, ContentsResponse };
147
+ export { Comment, Commit, CommitStatus, CommitStatusType, ContentsListResponse, Issue, IssueState, Label, NullablePR, PR, PRList, PRMergeMethod, PRState, Repo, RepoContents, RepoPermission, RepoSearchResults, User, Version };
12
148
 
13
149
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":[],"sources":["../../../../lib/modules/platform/gitea/schema.ts"],"sourcesContent":["import { z } from 'zod/v4';\n\nexport const ContentsResponse = z.object({\n name: z.string(),\n path: z.string(),\n type: z.union([z.literal('file'), z.literal('dir')]),\n content: z.string().nullable(),\n});\n\nexport type ContentsResponse = z.infer<typeof ContentsResponse>;\n\nexport const ContentsListResponse = z.array(ContentsResponse);\n"],"mappings":";;AAEA,MAAa,mBAAmB,EAAE,OAAO;CACvC,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,MAAM,GAAG,EAAE,QAAQ,KAAK,CAAC,CAAC;CACnD,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;AAC/B,CAAC;AAID,MAAa,uBAAuB,EAAE,MAAM,gBAAgB"}
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../../../../lib/modules/platform/gitea/schema.ts"],"sourcesContent":["import { z } from 'zod/v4';\nimport { LongCommitSha } from '../../../util/schema-utils/git.ts';\nimport {\n DeepNullish,\n EmailAddress,\n LooseArray,\n} from '../../../util/schema-utils/index.ts';\nimport { fromBase64 } from '../../../util/string.ts';\n\nconst ContentsCommon = z.object({\n name: z.string(),\n path: z.string(),\n});\n\nconst ContentsFile = ContentsCommon.extend({\n type: z.literal('file'),\n content: z.string().nullable(),\n}).transform((input) => ({\n ...input,\n contentString: input.content ? fromBase64(input.content) : '',\n}));\n\nconst ContentsDir = ContentsCommon.extend({ type: z.literal('dir') });\nconst ContentsSymlink = ContentsCommon.extend({ type: z.literal('symlink') });\nconst ContentsSubmodule = ContentsCommon.extend({\n type: z.literal('submodule'),\n});\n\nexport const RepoContents = z.discriminatedUnion('type', [\n ContentsFile,\n ContentsDir,\n ContentsSymlink,\n ContentsSubmodule,\n]);\nexport type RepoContents = z.infer<typeof RepoContents>;\n\nexport const ContentsListResponse = z.array(RepoContents);\n\nexport const User = DeepNullish(\n z.object({\n id: z.number(),\n // catch empty strings which are returned if an organization has no email\n email: EmailAddress.optional().catch(undefined),\n full_name: z.string().optional(),\n login: z.string(),\n }),\n);\nexport type User = z.infer<typeof User>;\n\nexport const RepoPermission = z.object({\n admin: z.boolean(),\n pull: z.boolean(),\n push: z.boolean(),\n});\nexport type RepoPermission = z.infer<typeof RepoPermission>;\n\nexport const PRMergeMethod = z.enum([\n 'fast-forward-only',\n 'merge',\n 'rebase',\n 'rebase-merge',\n 'squash',\n]);\nexport type PRMergeMethod = z.infer<typeof PRMergeMethod>;\n\n// Lenient Repo schema - only validates fields Renovate reads, most are optional\nexport const Repo = DeepNullish(\n z.object({\n id: z.number(),\n allow_fast_forward_only_merge: z.boolean().default(false),\n allow_merge_commits: z.boolean().default(false),\n allow_rebase: z.boolean().default(false),\n allow_rebase_explicit: z.boolean().default(false),\n allow_squash_merge: z.boolean().default(false),\n archived: z.boolean().optional(),\n clone_url: z.string().optional(),\n // catch unknown merge methods e.g. `manually-merged`\n default_merge_style: PRMergeMethod.optional().catch(undefined),\n external_tracker: z.unknown().optional(),\n has_issues: z.boolean().optional().default(false),\n has_pull_requests: z.boolean().optional(),\n ssh_url: z.string().optional(),\n default_branch: z.string(),\n empty: z.boolean().optional(),\n fork: z.boolean().optional(),\n full_name: z.string(),\n mirror: z.boolean().optional(),\n owner: User,\n permissions: RepoPermission,\n }),\n);\nexport type Repo = z.infer<typeof Repo>;\n\nexport const Label = DeepNullish(\n z.object({\n id: z.number(),\n name: z.string(),\n description: z.string().optional(),\n color: z.string().optional(),\n }),\n);\nexport type Label = z.infer<typeof Label>;\n\nexport const PRState = z.enum(['open', 'closed', 'all']);\nexport type PRState = z.infer<typeof PRState>;\n\nexport const IssueState = z.enum(['open', 'closed', 'all']);\nexport type IssueState = z.infer<typeof IssueState>;\n\n// Lenient partial repo schema for embedded repo references in PRs (only full_name is read)\nconst PartialRepo = z.object({\n full_name: z.string(),\n});\n\nexport const PR = DeepNullish(\n z.object({\n number: z.number(),\n state: PRState,\n title: z.string(),\n body: z.string(),\n mergeable: z.boolean(),\n merged: z.boolean().optional(),\n created_at: z.string(),\n updated_at: z.string(),\n closed_at: z.string().optional(),\n diff_url: z.string().optional(),\n base: z\n .object({\n ref: z.string(),\n })\n .optional(),\n head: z\n .object({\n label: z.string(),\n sha: LongCommitSha,\n repo: PartialRepo.optional(),\n })\n .optional(),\n assignee: User.optional(),\n assignees: z.array(User).optional(),\n user: User.optional(),\n labels: z.array(Label).optional(),\n }),\n);\nexport type PR = z.infer<typeof PR>;\n\n// TODO remove when the TEMPORARY_ERROR in pr-cache.ts is no longer needed\nexport const NullablePR = PR.nullable();\n\nexport const PRList = LooseArray(NullablePR);\n\nexport const Issue = DeepNullish(\n z.object({\n number: z.number(),\n state: IssueState.optional(),\n title: z.string(),\n body: z.string(),\n assignees: z.array(User).optional(),\n labels: z.array(Label).optional(),\n }),\n);\nexport type Issue = z.infer<typeof Issue>;\n\nexport const Comment = z.object({\n id: z.number(),\n body: z.string(),\n});\nexport type Comment = z.infer<typeof Comment>;\n\nexport const CommitStatusType = z\n .enum(['pending', 'success', 'error', 'failure', 'warning', 'unknown'])\n .catch('unknown');\nexport type CommitStatusType = z.infer<typeof CommitStatusType>;\n\nexport const CommitStatus = DeepNullish(\n z.object({\n id: z.number(),\n status: CommitStatusType,\n context: z.string(),\n description: z.string().optional(),\n target_url: z.string().optional(),\n created_at: z.string(),\n }),\n);\nexport type CommitStatus = z.infer<typeof CommitStatus>;\n\nexport const Commit = z.object({\n id: z.string(),\n});\nexport type Commit = z.infer<typeof Commit>;\n\nexport const Branch = z.object({\n name: z.string(),\n commit: Commit,\n});\nexport type Branch = z.infer<typeof Branch>;\n\nexport const RepoSearchResults = z.object({\n ok: z.boolean(),\n data: z.array(Repo),\n});\n\nexport const Version = z.object({\n version: z.string(),\n});\n"],"mappings":";;;;;AASA,MAAM,iBAAiB,EAAE,OAAO;CAC9B,MAAM,EAAE,OAAO;CACf,MAAM,EAAE,OAAO;AACjB,CAAC;AAED,MAAM,eAAe,eAAe,OAAO;CACzC,MAAM,EAAE,QAAQ,MAAM;CACtB,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;AAC/B,CAAC,CAAC,CAAC,WAAW,WAAW;CACvB,GAAG;CACH,eAAe,MAA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AO,EAC9B,SAAS,EAAE,OAAO,EACpB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { CONFIG_GIT_URL_UNAVAILABLE, REPOSITORY_BLOCKED } from "../../../constants/error-messages.js";
1
+ import { CONFIG_GIT_URL_UNAVAILABLE } from "../../../constants/error-messages.js";
2
2
  import { regEx } from "../../../util/regex.js";
3
3
  import { coerceArray } from "../../../util/array.js";
4
4
  import { logger } from "../../../logger/index.js";
@@ -13,14 +13,14 @@ function smartLinks(body) {
13
13
  function trimTrailingApiPath(url) {
14
14
  return url?.replace(regEx(/api\/v1\/?$/g), "");
15
15
  }
16
- function getRepoUrl(repo, gitUrl, endpoint) {
16
+ function getRepoUrl(repo, gitUrl, endpoint, hostType) {
17
17
  if (gitUrl === "ssh") {
18
18
  if (!repo.ssh_url) throw new Error(CONFIG_GIT_URL_UNAVAILABLE);
19
19
  logger.debug(`Using SSH URL: ${repo.ssh_url}`);
20
20
  return repo.ssh_url;
21
21
  }
22
22
  const opts = find({
23
- hostType: "gitea",
23
+ hostType,
24
24
  url: endpoint
25
25
  });
26
26
  if (gitUrl === "endpoint") {
@@ -48,10 +48,14 @@ function getMergeMethod(strategy) {
48
48
  }
49
49
  }
50
50
  const API_PATH = "/api/v1";
51
+ /** Human readable name of each platform, used in log messages. */
52
+ const platformDisplayName = {
53
+ gitea: "Gitea",
54
+ forgejo: "Forgejo"
55
+ };
51
56
  const DRAFT_PREFIX = "WIP: ";
52
57
  const reconfigurePrRegex = regEx(/reconfigure$/);
53
58
  function toRenovatePR(data, author) {
54
- if (!data) return null;
55
59
  if (!data.base?.ref || !data.head?.label || !data.head?.sha || !data.head?.repo?.full_name) {
56
60
  logger.trace(`Skipping Pull Request #${data.number} due to missing base and/or head branch`);
57
61
  return null;
@@ -65,7 +69,7 @@ function toRenovatePR(data, author) {
65
69
  isDraft = true;
66
70
  }
67
71
  return {
68
- labels: coerceArray(data?.labels).map((l) => l.name),
72
+ labels: coerceArray(data.labels).map((l) => l.name),
69
73
  number: data.number,
70
74
  state: data.merged ? "merged" : data.state,
71
75
  title,
@@ -109,10 +113,8 @@ function isAllowed(style, repo) {
109
113
  case "squash": return repo.allow_squash_merge;
110
114
  case "fast-forward-only": return repo.allow_fast_forward_only_merge;
111
115
  }
112
- logger.debug("Repo has unknown merge style - aborting renovation");
113
- throw new Error(REPOSITORY_BLOCKED);
114
116
  }
115
117
  //#endregion
116
- export { API_PATH, DRAFT_PREFIX, getMergeMethod, getRepoUrl, isAllowed, smartLinks, toRenovatePR, trimTrailingApiPath, usableRepo };
118
+ export { API_PATH, DRAFT_PREFIX, getMergeMethod, getRepoUrl, isAllowed, platformDisplayName, smartLinks, toRenovatePR, trimTrailingApiPath, usableRepo };
117
119
 
118
120
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["hostRules.find"],"sources":["../../../../lib/modules/platform/gitea/utils.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport type { MergeStrategy } from '../../../config/types.ts';\nimport {\n CONFIG_GIT_URL_UNAVAILABLE,\n REPOSITORY_BLOCKED,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { parseUrl } from '../../../util/url.ts';\nimport { getPrBodyStruct } from '../pr-body.ts';\nimport type { GitUrlOption, Pr } from '../types.ts';\nimport type { PR, PRMergeMethod, Repo } from './types.ts';\n\nexport function smartLinks(body: string): string {\n return body\n ?.replace(regEx(/\\]\\(\\.\\.\\/issues\\//g), '](issues/')\n .replace(regEx(/\\]\\(\\.\\.\\/pull\\//g), '](pulls/');\n}\n\nexport function trimTrailingApiPath(url: string): string {\n return url?.replace(regEx(/api\\/v1\\/?$/g), '');\n}\n\nexport function getRepoUrl(\n repo: Repo,\n gitUrl: GitUrlOption | undefined,\n endpoint: string,\n): string {\n if (gitUrl === 'ssh') {\n if (!repo.ssh_url) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n logger.debug(`Using SSH URL: ${repo.ssh_url}`);\n return repo.ssh_url;\n }\n\n // Find options for current host and determine Git endpoint\n const opts = hostRules.find({\n hostType: 'gitea',\n url: endpoint,\n });\n\n if (gitUrl === 'endpoint') {\n const url = parseUrl(endpoint);\n if (!url) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n url.username = opts.token ?? '';\n url.pathname = `${url.pathname}${repo.full_name}.git`;\n logger.debug(\n { url: url.toString() },\n 'using URL based on configured endpoint',\n );\n return url.toString();\n }\n\n if (!repo.clone_url) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n\n logger.debug(`Using HTTP URL: ${repo.clone_url}`);\n const repoUrl = parseUrl(repo.clone_url);\n if (!repoUrl) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n repoUrl.username = opts.token ?? '';\n return repoUrl.toString();\n}\n\nexport function getMergeMethod(\n strategy: MergeStrategy | undefined,\n): PRMergeMethod | null {\n switch (strategy) {\n case 'fast-forward':\n return 'rebase';\n case 'merge-commit':\n return 'merge';\n case 'rebase':\n return 'rebase-merge';\n case 'squash':\n return strategy;\n case 'auto':\n default:\n return null;\n }\n}\n\nexport const API_PATH = '/api/v1';\n\nexport const DRAFT_PREFIX = 'WIP: ';\nconst reconfigurePrRegex = regEx(/reconfigure$/);\n\nexport function toRenovatePR(data: PR, author: string | null): Pr | null {\n if (!data) {\n return null;\n }\n\n if (\n !data.base?.ref ||\n !data.head?.label ||\n !data.head?.sha ||\n !data.head?.repo?.full_name\n ) {\n logger.trace(\n `Skipping Pull Request #${data.number} due to missing base and/or head branch`,\n );\n return null;\n }\n\n const createdBy = data.user?.login;\n if (\n createdBy &&\n author &&\n !reconfigurePrRegex.test(data.head.label) &&\n createdBy !== author\n ) {\n return null;\n }\n\n let title = data.title;\n let isDraft = false;\n if (title.startsWith(DRAFT_PREFIX)) {\n title = title.substring(DRAFT_PREFIX.length);\n isDraft = true;\n }\n const labels = coerceArray(data?.labels).map((l) => l.name);\n\n return {\n labels,\n number: data.number,\n state: data.merged ? 'merged' : data.state,\n title,\n isDraft,\n bodyStruct: getPrBodyStruct(data.body),\n sha: data.head.sha,\n sourceBranch: data.head.label,\n targetBranch: data.base.ref,\n sourceRepo: data.head.repo.full_name,\n createdAt: data.created_at,\n cannotMergeReason: data.mergeable\n ? undefined\n : `pr.mergeable=\"${data.mergeable}\"`,\n hasAssignees: !!(data.assignee?.login ?? isNonEmptyArray(data.assignees)),\n };\n}\n\n/**\n * Check if a repository is usable.\n * A repo isn't usable if one of the following conditions is met:\n * - The repo is a `mirror`\n * - We don't have pull or push permissions\n * - Pull requests are disabled\n * @param repo Repo to check\n * @returns `true` if the repository is usable, `false` otherwise\n */\nexport function usableRepo(repo: Repo): boolean {\n if (repo.mirror === true) {\n return false;\n }\n\n if (repo.permissions.pull === false || repo.permissions.push === false) {\n logger.debug(\n `Skipping repository ${repo.full_name} because of missing pull or push permissions`,\n );\n return false;\n }\n\n if (repo.has_pull_requests === false) {\n logger.debug(\n `Skipping repository ${repo.full_name} because pull requests are disabled`,\n );\n return false;\n }\n return true;\n}\n\nexport function isAllowed(style: PRMergeMethod, repo: Repo): boolean {\n switch (style) {\n case 'merge':\n return repo.allow_merge_commits;\n case 'rebase':\n return repo.allow_rebase;\n case 'rebase-merge':\n return repo.allow_rebase_explicit;\n case 'squash':\n return repo.allow_squash_merge;\n case 'fast-forward-only':\n return repo.allow_fast_forward_only_merge;\n }\n logger.debug('Repo has unknown merge style - aborting renovation');\n throw new Error(REPOSITORY_BLOCKED);\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,WAAW,MAAsB;CAC/C,OAAO,MACH,QAAQ,MAAM,qBAAqB,GAAG,WAAW,CAAC,CACnD,QAAQ,MAAM,mBAAmB,GAAG,UAAU;AACnD;AAEA,SAAgB,oBAAoB,KAAqB;CACvD,OAAO,KAAK,QAAQ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,MAAM,kBAAkB;AACpC"}
1
+ {"version":3,"file":"utils.js","names":["hostRules.find"],"sources":["../../../../lib/modules/platform/gitea/utils.ts"],"sourcesContent":["import { isNonEmptyArray } from '@sindresorhus/is';\nimport type { MergeStrategy } from '../../../config/types.ts';\nimport { CONFIG_GIT_URL_UNAVAILABLE } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { parseUrl } from '../../../util/url.ts';\nimport { getPrBodyStruct } from '../pr-body.ts';\nimport type { GitUrlOption, Pr } from '../types.ts';\nimport type { PR, PRMergeMethod, Repo } from './schema.ts';\nimport type { GiteaPlatformKey } from './types.ts';\n\nexport function smartLinks(body: string): string {\n return body\n ?.replace(regEx(/\\]\\(\\.\\.\\/issues\\//g), '](issues/')\n .replace(regEx(/\\]\\(\\.\\.\\/pull\\//g), '](pulls/');\n}\n\nexport function trimTrailingApiPath(url: string): string {\n return url?.replace(regEx(/api\\/v1\\/?$/g), '');\n}\n\nexport function getRepoUrl(\n repo: Repo,\n gitUrl: GitUrlOption | undefined,\n endpoint: string,\n hostType: string,\n): string {\n if (gitUrl === 'ssh') {\n if (!repo.ssh_url) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n logger.debug(`Using SSH URL: ${repo.ssh_url}`);\n return repo.ssh_url;\n }\n\n // Find options for current host and determine Git endpoint\n const opts = hostRules.find({\n hostType,\n url: endpoint,\n });\n\n if (gitUrl === 'endpoint') {\n const url = parseUrl(endpoint);\n if (!url) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n url.username = opts.token ?? '';\n url.pathname = `${url.pathname}${repo.full_name}.git`;\n logger.debug(\n { url: url.toString() },\n 'using URL based on configured endpoint',\n );\n return url.toString();\n }\n\n if (!repo.clone_url) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n\n logger.debug(`Using HTTP URL: ${repo.clone_url}`);\n const repoUrl = parseUrl(repo.clone_url);\n if (!repoUrl) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n repoUrl.username = opts.token ?? '';\n return repoUrl.toString();\n}\n\nexport function getMergeMethod(\n strategy: MergeStrategy | undefined,\n): PRMergeMethod | null {\n switch (strategy) {\n case 'fast-forward':\n return 'rebase';\n case 'merge-commit':\n return 'merge';\n case 'rebase':\n return 'rebase-merge';\n case 'squash':\n return strategy;\n case 'auto':\n default:\n return null;\n }\n}\n\nexport const API_PATH = '/api/v1';\n\n/** Human readable name of each platform, used in log messages. */\nexport const platformDisplayName = {\n gitea: 'Gitea',\n forgejo: 'Forgejo',\n} as const satisfies Record<GiteaPlatformKey, string>;\n\nexport const DRAFT_PREFIX = 'WIP: ';\nconst reconfigurePrRegex = regEx(/reconfigure$/);\n\nexport function toRenovatePR(data: PR, author: string | null): Pr | null {\n if (\n !data.base?.ref ||\n !data.head?.label ||\n !data.head?.sha ||\n !data.head?.repo?.full_name\n ) {\n logger.trace(\n `Skipping Pull Request #${data.number} due to missing base and/or head branch`,\n );\n return null;\n }\n\n const createdBy = data.user?.login;\n if (\n createdBy &&\n author &&\n !reconfigurePrRegex.test(data.head.label) &&\n createdBy !== author\n ) {\n return null;\n }\n\n let title = data.title;\n let isDraft = false;\n if (title.startsWith(DRAFT_PREFIX)) {\n title = title.substring(DRAFT_PREFIX.length);\n isDraft = true;\n }\n const labels = coerceArray(data.labels).map((l) => l.name);\n\n return {\n labels,\n number: data.number,\n state: data.merged ? 'merged' : data.state,\n title,\n isDraft,\n bodyStruct: getPrBodyStruct(data.body),\n sha: data.head.sha,\n sourceBranch: data.head.label,\n targetBranch: data.base.ref,\n sourceRepo: data.head.repo.full_name,\n createdAt: data.created_at,\n cannotMergeReason: data.mergeable\n ? undefined\n : `pr.mergeable=\"${data.mergeable}\"`,\n hasAssignees: !!(data.assignee?.login ?? isNonEmptyArray(data.assignees)),\n };\n}\n\n/**\n * Check if a repository is usable.\n * A repo isn't usable if one of the following conditions is met:\n * - The repo is a `mirror`\n * - We don't have pull or push permissions\n * - Pull requests are disabled\n * @param repo Repo to check\n * @returns `true` if the repository is usable, `false` otherwise\n */\nexport function usableRepo(repo: Repo): boolean {\n if (repo.mirror === true) {\n return false;\n }\n\n if (repo.permissions.pull === false || repo.permissions.push === false) {\n logger.debug(\n `Skipping repository ${repo.full_name} because of missing pull or push permissions`,\n );\n return false;\n }\n\n if (repo.has_pull_requests === false) {\n logger.debug(\n `Skipping repository ${repo.full_name} because pull requests are disabled`,\n );\n return false;\n }\n return true;\n}\n\nexport function isAllowed(style: PRMergeMethod, repo: Repo): boolean {\n switch (style) {\n case 'merge':\n return repo.allow_merge_commits;\n case 'rebase':\n return repo.allow_rebase;\n case 'rebase-merge':\n return repo.allow_rebase_explicit;\n case 'squash':\n return repo.allow_squash_merge;\n case 'fast-forward-only':\n return repo.allow_fast_forward_only_merge;\n }\n}\n"],"mappings":";;;;;;;;;AAaA,SAAgB,WAAW,MAAsB;CAC/C,OAAO,MACH,QAAQ,MAAM,qBAAqB,GAAG,WAAW,CAAC,CACnD,QAAQ,MAAM,mBAAmB,GAAG,UAAU;AACnD;AAEA,SAAgB,oBAAoB,KAAqB;CACvD,OAAO,KAAK,QAAQ,MAAM,cAAc,GAAG,EAAE;AAC/C;AAEA,SAAgB,WACd,MACA,QACA,UACA,UACQ;CACR,IAAI,WAAW,OAAO;EACpB,IAAI,CAAC,KAAK,SACR,MAAM,IAAI,MAAM,0BAA0B;EAE5C,OAAO,MAAM,kBAAkB,KAAK,SAAS;EAC7C,OAAO,KAAK;CACd;CAGA,MAAM,OAAOA,KAAe;EAC1B;EACA,KAAK;CACP,CAAC;CAED,IAAI,WAAW,YAAY;EACzB,MAAM,MAAM,SAAS,QAAQ;EAC7B,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,0BAA0B;EAE5C,IAAI,WAAW,KAAK,SAAS;EAC7B,IAAI,WAAW,GAAG,IAA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AY,gBAAgB,KAAK,IAAI;EACrC,KAAK,KAAK,KAAK;EACf,cAAc,KAAK,KAAK;EACxB,cAAc,KAAK,KAAK;EACxB,YAAY,KAAK,KAAK,KAAK;EAC3B,WAAW,KAAK;EAChB,mBAAmB,KAAK,YACpB,KAAA,IACA,iBAAiB,KAAK,UAAU;EACpC,cAAc,CAAC,EAAE,KAAK,UAAU,SAAS,gBAAgB,KAAK,SAAS;CACzE;AACF;;;;;;;;;;AAWA,SAAgB,WAAW,MAAqB;CAC9C,IAAI,KAAK,WAAW,MAClB,OAAO;CAGT,IAAI,KAAK,YAAY,SAAS,SAAS,KAAK,YAAY,SAAS,OAAO;EACtE,OAAO,MACL,uBAAuB,KAAK,UAAU,6CACxC;EACA,OAAO;CACT;CAEA,IAAI,KAAK,sBAAsB,OAAO;EACpC,OAAO,MACL,uBAAuB,KAAK,UAAU,oCACxC;EACA,OAAO;CACT;CACA,OAAO;AACT;AAEA,SAAgB,UAAU,OAAsB,MAAqB;CACnE,QAAQ,OAAR;EACE,KAAK,SACH,OAAO,KAAK;EACd,KAAK,UACH,OAAO,KAAK;EACd,KAAK,gBACH,OAAO,KAAK;EACd,KAAK,UACH,OAAO,KAAK;EACd,KAAK,qBACH,OAAO,KAAK;CAChB;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
2
- import { REPOSITORY_ACCESS_FORBIDDEN, REPOSITORY_ARCHIVED, REPOSITORY_CHANGED, REPOSITORY_DISABLED, REPOSITORY_EMPTY, REPOSITORY_MIRRORED, REPOSITORY_NOT_FOUND, TEMPORARY_ERROR } from "../../../constants/error-messages.js";
2
+ import { REPOSITORY_ACCESS_FORBIDDEN, REPOSITORY_ARCHIVED, REPOSITORY_CHANGED, REPOSITORY_DISABLED, REPOSITORY_EMPTY, REPOSITORY_MIRRORED, REPOSITORY_NOT_FOUND, REPOSITORY_PENDING_DELETION, TEMPORARY_ERROR } from "../../../constants/error-messages.js";
3
3
  import { getEnv } from "../../../util/env.js";
4
4
  import { regEx } from "../../../util/regex.js";
5
5
  import { GlobalConfig } from "../../../config/global.js";
@@ -130,7 +130,7 @@ async function getRepos(config) {
130
130
  try {
131
131
  const repos = (await pMap(urls, (url) => gitlabApi.getJsonUnchecked(url, { paginate: true }), { concurrency: 2 })).flatMap((response) => response.body);
132
132
  logger.debug(`Discovered ${repos.length} project(s)`);
133
- return repos.filter((repo) => !repo.mirror || config?.includeMirrors).map((repo) => repo.path_with_namespace);
133
+ return repos.filter((repo) => !repo.mirror || config?.includeMirrors).filter((repo) => !repo.marked_for_deletion_at).map((repo) => repo.path_with_namespace);
134
134
  } catch (err) {
135
135
  logger.error({ err }, `GitLab getRepos error`);
136
136
  throw err;
@@ -162,6 +162,10 @@ async function initRepo({ repository, cloneSubmodules, cloneSubmodulesFilter, gi
162
162
  logger.debug("Repository is archived - throwing error to abort renovation");
163
163
  throw new Error(REPOSITORY_ARCHIVED);
164
164
  }
165
+ if (res.body.marked_for_deletion_at) {
166
+ logger.debug("Repository is marked for deletion - throwing error to abort renovation");
167
+ throw new Error(REPOSITORY_PENDING_DELETION);
168
+ }
165
169
  if (res.body.mirror && GlobalConfig.get("includeMirrors") !== true) {
166
170
  logger.debug("Repository is a mirror - throwing error to abort renovation");
167
171
  throw new Error(REPOSITORY_MIRRORED);
@@ -194,7 +198,11 @@ async function initRepo({ repository, cloneSubmodules, cloneSubmodulesFilter, gi
194
198
  } catch (err) /* v8 ignore next -- initRepo error mapping needs git-level failures not mocked in specs */ {
195
199
  logger.debug({ err }, "Caught initRepo error");
196
200
  if (err.message.includes("HEAD is not a symbolic ref")) throw new Error(REPOSITORY_EMPTY);
197
- if (["archived", "empty"].includes(err.message)) throw err;
201
+ if ([
202
+ "archived",
203
+ "empty",
204
+ "pending-deletion"
205
+ ].includes(err.message)) throw err;
198
206
  if (err.statusCode === 403) throw new Error(REPOSITORY_ACCESS_FORBIDDEN);
199
207
  if (err.statusCode === 404) throw new Error(REPOSITORY_NOT_FOUND);
200
208
  if (err.message === "disabled") throw err;