@simplysf/simply-cicd 0.8.12 → 0.9.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.
- package/lib/commands/simply/cicd/build/create-fallback-tag.d.ts +1 -1
- package/lib/commands/simply/cicd/build/create-package-version.d.ts +1 -1
- package/lib/commands/simply/cicd/build/generate-flexipage-diff.d.ts +1 -1
- package/lib/commands/simply/cicd/build/generate-flow-diff.d.ts +1 -1
- package/lib/commands/simply/cicd/build/install-dependencies.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/happy-soup/deploy-unpackaged.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/happy-soup/deployment-close-out.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/happy-soup/install-packaged.d.ts +2 -2
- package/lib/commands/simply/cicd/deploy/happy-soup/post-deploy.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/happy-soup/post-destructive.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/happy-soup/pre-destructive.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/happy-soup/tag-deployment.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/project/deploy-unpackaged.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/project/install-packaged.d.ts +2 -2
- package/lib/commands/simply/cicd/deploy/project/post-deploy.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/project/post-destructive.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/project/pre-destructive.d.ts +1 -1
- package/lib/commands/simply/cicd/deploy/project/run-apex-tests.d.ts +1 -1
- package/lib/commands/simply/cicd/notify/happy-soup.d.ts +1 -1
- package/lib/commands/simply/cicd/notify/happy-soup.js +1 -1
- package/lib/commands/simply/cicd/notify/happy-soup.js.map +1 -1
- package/lib/commands/simply/cicd/notify/project.d.ts +1 -1
- package/lib/commands/simply/cicd/notify/project.js +1 -1
- package/lib/commands/simply/cicd/notify/project.js.map +1 -1
- package/lib/commands/simply/cicd/sfdx-dependabot.d.ts +1 -1
- package/lib/commands/simply/cicd/sfdx-dependabot.js +1 -1
- package/lib/commands/simply/cicd/sfdx-dependabot.js.map +1 -1
- package/lib/common/build/createFallbackTag.d.ts +1 -1
- package/lib/common/build/createFallbackTag.js +1 -1
- package/lib/common/build/createFallbackTag.js.map +1 -1
- package/lib/common/build/createPackageVersion.d.ts +1 -1
- package/lib/common/build/createPackageVersion.js +1 -1
- package/lib/common/build/createPackageVersion.js.map +1 -1
- package/lib/common/build/deltaRunner.d.ts +1 -1
- package/lib/common/build/deltaRunner.js +1 -1
- package/lib/common/build/deltaRunner.js.map +1 -1
- package/lib/common/build/flags.d.ts +1 -1
- package/lib/common/build/flags.js +1 -1
- package/lib/common/build/flags.js.map +1 -1
- package/lib/common/deploy/deployCommon.d.ts +1 -1
- package/lib/common/deploy/deployCommon.js +1 -1
- package/lib/common/deploy/deployCommon.js.map +1 -1
- package/lib/common/deploy/deployHappySoup.d.ts +1 -1
- package/lib/common/deploy/deployHappySoup.js +1 -1
- package/lib/common/deploy/deployHappySoup.js.map +1 -1
- package/lib/common/deploy/deployProject.d.ts +1 -1
- package/lib/common/deploy/deployProject.js.map +1 -1
- package/lib/common/deploy/flags.d.ts +1 -1
- package/lib/common/deploy/flags.js +1 -1
- package/lib/common/deploy/flags.js.map +1 -1
- package/lib/common/deploy/stageCommand.d.ts +2 -2
- package/lib/common/git.d.ts +1 -1
- package/lib/common/happySoup/resolveOriginProject.d.ts +1 -1
- package/lib/common/happySoup/resolveOriginProject.js +1 -1
- package/lib/common/happySoup/resolveOriginProject.js.map +1 -1
- package/lib/common/notify/getCommitStories.d.ts +1 -1
- package/lib/common/notify/getCommitStories.js +1 -1
- package/lib/common/notify/getCommitStories.js.map +1 -1
- package/lib/common/notify/getRemoteCommitStories.d.ts +1 -1
- package/lib/common/notify/happySoupNotification.d.ts +1 -1
- package/lib/common/notify/happySoupNotification.js +1 -2
- package/lib/common/notify/happySoupNotification.js.map +1 -1
- package/lib/common/notify/projectNotification.d.ts +1 -1
- package/lib/common/notify/projectNotification.js +1 -1
- package/lib/common/notify/projectNotification.js.map +1 -1
- package/lib/common/sfConfig.d.ts +1 -1
- package/lib/common/sfdxDependabot/dependabotRun.d.ts +1 -1
- package/lib/common/sfdxDependabot/dependabotRun.js.map +1 -1
- package/package.json +4 -3
- package/lib/common/alm/gitlabIssues.d.ts +0 -11
- package/lib/common/alm/gitlabIssues.js +0 -54
- package/lib/common/alm/gitlabIssues.js.map +0 -1
- package/lib/common/alm/index.d.ts +0 -4
- package/lib/common/alm/index.js +0 -24
- package/lib/common/alm/index.js.map +0 -1
- package/lib/common/alm/jira.d.ts +0 -8
- package/lib/common/alm/jira.js +0 -43
- package/lib/common/alm/jira.js.map +0 -1
- package/lib/common/alm/registry.d.ts +0 -10
- package/lib/common/alm/registry.js +0 -37
- package/lib/common/alm/registry.js.map +0 -1
- package/lib/common/alm/types.d.ts +0 -35
- package/lib/common/alm/types.js +0 -17
- package/lib/common/alm/types.js.map +0 -1
- package/lib/common/vcs/github.d.ts +0 -28
- package/lib/common/vcs/github.js +0 -267
- package/lib/common/vcs/github.js.map +0 -1
- package/lib/common/vcs/gitlab.d.ts +0 -30
- package/lib/common/vcs/gitlab.js +0 -242
- package/lib/common/vcs/gitlab.js.map +0 -1
- package/lib/common/vcs/index.d.ts +0 -4
- package/lib/common/vcs/index.js +0 -24
- package/lib/common/vcs/index.js.map +0 -1
- package/lib/common/vcs/registry.d.ts +0 -10
- package/lib/common/vcs/registry.js +0 -37
- package/lib/common/vcs/registry.js.map +0 -1
- package/lib/common/vcs/types.d.ts +0 -136
- package/lib/common/vcs/types.js +0 -17
- package/lib/common/vcs/types.js.map +0 -1
package/lib/common/alm/jira.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/** Escapes a configured project key so it can be embedded in the match pattern literally. */
|
|
17
|
-
function escapeKey(projectKey) {
|
|
18
|
-
return projectKey.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
19
|
-
}
|
|
20
|
-
/** An `AlmProvider` for Jira, which keys issues as `PROJECT-123`. */
|
|
21
|
-
export class JiraProvider {
|
|
22
|
-
kind = 'jira';
|
|
23
|
-
issueNoun = 'story';
|
|
24
|
-
// eslint-disable-next-line class-methods-use-this -- part of the AlmProvider instance contract; matching needs no instance state
|
|
25
|
-
extractIssues(commitLog, projectKeys) {
|
|
26
|
-
if (projectKeys.length === 0) {
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
const pattern = new RegExp(`(?:${projectKeys.map(escapeKey).join('|')})-[0-9]+`, 'gi');
|
|
30
|
-
// Matching against the upper-cased log normalizes keys written in mixed case.
|
|
31
|
-
const matches = commitLog.toUpperCase().match(pattern) ?? [];
|
|
32
|
-
return [...new Set(matches)].sort().map((key) => ({ key, label: key, urlSegment: key }));
|
|
33
|
-
}
|
|
34
|
-
// eslint-disable-next-line class-methods-use-this -- part of the AlmProvider instance contract; rendering needs no instance state
|
|
35
|
-
render(issues, baseUrl) {
|
|
36
|
-
const plain = issues.map((issue) => issue.label).join(', ');
|
|
37
|
-
const html = baseUrl
|
|
38
|
-
? issues.map((issue) => `<a href='${baseUrl}/${issue.urlSegment}'>${issue.label}</a>`).join(', ')
|
|
39
|
-
: plain;
|
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C,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,OAAO;YAClB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,OAAO,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACjG,CAAC,CAAC,KAAK,CAAC;QACV,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AlmProvider, AlmProviderFactory, AlmProviderKind } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Registers an ALM implementation. Built-in providers register themselves when `./index.js` is
|
|
4
|
-
* imported; call this directly to add a tracker without modifying this package.
|
|
5
|
-
*/
|
|
6
|
-
export declare function registerAlmProvider(kind: AlmProviderKind, factory: AlmProviderFactory): void;
|
|
7
|
-
/** The trackers currently registered, for flag options and error messages. */
|
|
8
|
-
export declare function listAlmProviderKinds(): AlmProviderKind[];
|
|
9
|
-
/** Builds a provider for the given ALM tool. */
|
|
10
|
-
export declare function createAlmProvider(kind: AlmProviderKind): AlmProvider;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
const factories = new Map();
|
|
17
|
-
/**
|
|
18
|
-
* Registers an ALM implementation. Built-in providers register themselves when `./index.js` is
|
|
19
|
-
* imported; call this directly to add a tracker without modifying this package.
|
|
20
|
-
*/
|
|
21
|
-
export function registerAlmProvider(kind, factory) {
|
|
22
|
-
factories.set(kind, factory);
|
|
23
|
-
}
|
|
24
|
-
/** The trackers currently registered, for flag options and error messages. */
|
|
25
|
-
export function listAlmProviderKinds() {
|
|
26
|
-
return [...factories.keys()].sort();
|
|
27
|
-
}
|
|
28
|
-
/** Builds a provider for the given ALM tool. */
|
|
29
|
-
export function createAlmProvider(kind) {
|
|
30
|
-
const factory = factories.get(kind);
|
|
31
|
-
if (!factory) {
|
|
32
|
-
const known = listAlmProviderKinds().join(', ');
|
|
33
|
-
throw new Error(`ALM provider "${kind}" is not supported. Registered providers: ${known}.`);
|
|
34
|
-
}
|
|
35
|
-
return factory();
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/common/alm/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuC,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAqB,EAAE,OAA2B;IACpF,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,oBAAoB;IAClC,OAAO,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,oBAAoB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAc,6CAA6C,KAAK,GAAG,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,OAAO,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** The set of application-lifecycle-management tools `simply-cicd` knows how to reference. */
|
|
2
|
-
export type AlmProviderKind = 'jira' | 'gitlab-issues';
|
|
3
|
-
/** A single issue reference found in a commit log, normalized across ALM tools. */
|
|
4
|
-
export type AlmIssueRef = {
|
|
5
|
-
/** The reference exactly as it was matched, e.g. `ABC-123` or `#42`. */
|
|
6
|
-
key: string;
|
|
7
|
-
/** How the reference is shown to a reader. */
|
|
8
|
-
label: string;
|
|
9
|
-
/** Path segment appended to the base URL to link the issue, e.g. `ABC-123` or `42`. */
|
|
10
|
-
urlSegment: string;
|
|
11
|
-
};
|
|
12
|
-
/** A rendered set of issue references: always plain text, plus HTML links when a base URL is known. */
|
|
13
|
-
export type AlmIssueRendering = {
|
|
14
|
-
plain: string;
|
|
15
|
-
html: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* An issue-tracker integration, abstracted so that the notification path never encodes one tool's
|
|
19
|
-
* key format or link shape. Only the parts that genuinely differ between trackers live here: how a
|
|
20
|
-
* reference is recognized in a commit message, and how it is displayed and linked.
|
|
21
|
-
*/
|
|
22
|
-
export interface AlmProvider {
|
|
23
|
-
readonly kind: AlmProviderKind;
|
|
24
|
-
/** What this tool calls the things it tracks, for user-facing text. */
|
|
25
|
-
readonly issueNoun: string;
|
|
26
|
-
/**
|
|
27
|
-
* Finds issue references in a commit log. `projectKeys` is only meaningful for prefix-keyed
|
|
28
|
-
* trackers such as Jira; trackers that number issues per repository ignore it.
|
|
29
|
-
*/
|
|
30
|
-
extractIssues(commitLog: string, projectKeys: string[]): AlmIssueRef[];
|
|
31
|
-
/** Renders references as plain text, and as HTML links when `baseUrl` is provided. */
|
|
32
|
-
render(issues: AlmIssueRef[], baseUrl?: string): AlmIssueRendering;
|
|
33
|
-
}
|
|
34
|
-
/** Constructs a provider for one ALM tool. */
|
|
35
|
-
export type AlmProviderFactory = () => AlmProvider;
|
package/lib/common/alm/types.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/common/alm/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { VcsBranch, VcsCiContext, VcsCommit, VcsCommitLogEntry, VcsMergeRequest, VcsProject, VcsProjectRef, VcsProjectVariable, VcsProvider, VcsProviderOptions, VcsTerminology } from './types.js';
|
|
2
|
-
/** A `VcsProvider` implementation for GitHub, backed by the GitHub REST API. */
|
|
3
|
-
export declare class GitHubProvider implements VcsProvider {
|
|
4
|
-
/** Used when no `--vcs-host` is supplied, so selecting a provider is enough to reach its SaaS instance. */
|
|
5
|
-
static readonly defaultHost = "github.com";
|
|
6
|
-
readonly kind: "github";
|
|
7
|
-
readonly terminology: VcsTerminology;
|
|
8
|
-
readonly host: string;
|
|
9
|
-
readonly apiUrl: string;
|
|
10
|
-
private readonly token;
|
|
11
|
-
constructor(options: VcsProviderOptions);
|
|
12
|
-
getCiContext(): VcsCiContext;
|
|
13
|
-
listProjects(orgId: string | number): Promise<VcsProject[]>;
|
|
14
|
-
getFileContent(project: VcsProjectRef, filePath: string, ref: string): Promise<string>;
|
|
15
|
-
compareRefs(project: VcsProjectRef, from: string, to: string): Promise<VcsCommitLogEntry[]>;
|
|
16
|
-
branchExists(project: VcsProjectRef, branchName: string): Promise<boolean>;
|
|
17
|
-
createBranch(project: VcsProjectRef, branchName: string, ref: string): Promise<VcsBranch>;
|
|
18
|
-
commitFile(project: VcsProjectRef, branchName: string, commitMessage: string, filePath: string, content: string): Promise<VcsCommit>;
|
|
19
|
-
findOpenMergeRequest(project: VcsProjectRef, sourceBranch: string, targetBranch: string): Promise<VcsMergeRequest | undefined>;
|
|
20
|
-
createMergeRequest(project: VcsProjectRef, sourceBranch: string, targetBranch: string, title: string, description: string, labels?: string[]): Promise<VcsMergeRequest>;
|
|
21
|
-
updateMergeRequest(project: VcsProjectRef, mergeRequest: VcsMergeRequest, title: string, description: string, labels?: string[]): Promise<VcsMergeRequest>;
|
|
22
|
-
getProjectVariables(project: VcsProjectRef): Promise<VcsProjectVariable[]>;
|
|
23
|
-
buildChangeRequestUrl(projectUrl: string, changeRequestIid: string | number): string;
|
|
24
|
-
buildAuthenticatedRemoteUrl(token: string, projectPath: string): string;
|
|
25
|
-
buildCiCloneUrl(ciJobToken: string, projectPath: string): string;
|
|
26
|
-
private request;
|
|
27
|
-
private getJson;
|
|
28
|
-
}
|
package/lib/common/vcs/github.js
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2026, Clay Chipps.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
function normalizeProject(repo) {
|
|
17
|
-
return {
|
|
18
|
-
id: repo.id,
|
|
19
|
-
key: repo.full_name,
|
|
20
|
-
name: repo.name,
|
|
21
|
-
pathWithNamespace: repo.full_name,
|
|
22
|
-
defaultBranch: repo.default_branch,
|
|
23
|
-
archived: Boolean(repo.archived),
|
|
24
|
-
// GitHub has no `empty_repo` flag; a repo with no commits reports a zero size.
|
|
25
|
-
empty: repo.size === 0,
|
|
26
|
-
isFork: repo.fork === true,
|
|
27
|
-
raw: repo,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function normalizePullRequest(pullRequest) {
|
|
31
|
-
return {
|
|
32
|
-
id: pullRequest.id,
|
|
33
|
-
// GitHub's per-pull-request endpoints take the repo-scoped `number`.
|
|
34
|
-
iid: pullRequest.number,
|
|
35
|
-
title: pullRequest.title,
|
|
36
|
-
description: pullRequest.body,
|
|
37
|
-
sourceBranch: pullRequest.head.ref,
|
|
38
|
-
targetBranch: pullRequest.base.ref,
|
|
39
|
-
webUrl: pullRequest.html_url,
|
|
40
|
-
raw: pullRequest,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/** GitHub addresses repos as `owner/repo`, so each segment is encoded separately. */
|
|
44
|
-
function splitProject(project) {
|
|
45
|
-
const key = typeof project === 'object' ? project.key : String(project);
|
|
46
|
-
const [owner, repo] = key.split('/');
|
|
47
|
-
if (!owner || !repo) {
|
|
48
|
-
throw new Error(`Invalid GitHub repository "${key}". Expected "owner/repo".`);
|
|
49
|
-
}
|
|
50
|
-
return { owner: encodeURIComponent(owner), repo: encodeURIComponent(repo) };
|
|
51
|
-
}
|
|
52
|
-
function repoPath(project) {
|
|
53
|
-
const { owner, repo } = splitProject(project);
|
|
54
|
-
return `/repos/${owner}/${repo}`;
|
|
55
|
-
}
|
|
56
|
-
/** Encodes a file path for the contents API, preserving its directory separators. */
|
|
57
|
-
function encodeFilePath(filePath) {
|
|
58
|
-
return filePath.split('/').map(encodeURIComponent).join('/');
|
|
59
|
-
}
|
|
60
|
-
/** Extracts the `rel="next"` URL from a Link header, if present. */
|
|
61
|
-
function nextLink(linkHeader) {
|
|
62
|
-
if (!linkHeader) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
for (const part of linkHeader.split(',')) {
|
|
66
|
-
const match = /<(?<url>[^>]+)>\s*;\s*rel="next"/.exec(part);
|
|
67
|
-
if (match?.groups?.url) {
|
|
68
|
-
return match.groups.url;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
/** A `VcsProvider` implementation for GitHub, backed by the GitHub REST API. */
|
|
74
|
-
export class GitHubProvider {
|
|
75
|
-
/** Used when no `--vcs-host` is supplied, so selecting a provider is enough to reach its SaaS instance. */
|
|
76
|
-
static defaultHost = 'github.com';
|
|
77
|
-
kind = 'github';
|
|
78
|
-
terminology = {
|
|
79
|
-
changeRequest: 'pull request',
|
|
80
|
-
changeRequestShort: 'PR',
|
|
81
|
-
projectVariable: 'GitHub Actions variable',
|
|
82
|
-
};
|
|
83
|
-
host;
|
|
84
|
-
apiUrl;
|
|
85
|
-
token;
|
|
86
|
-
constructor(options) {
|
|
87
|
-
const { host, token, apiUrl } = options;
|
|
88
|
-
if (!token) {
|
|
89
|
-
throw new Error('GitHub access token is required.');
|
|
90
|
-
}
|
|
91
|
-
const resolvedHost = host ?? GitHubProvider.defaultHost;
|
|
92
|
-
// github.com serves its API from a dedicated hostname; GitHub Enterprise Server serves it
|
|
93
|
-
// from /api/v3 on the instance itself.
|
|
94
|
-
const derived = resolvedHost === GitHubProvider.defaultHost ? 'https://api.github.com' : `https://${resolvedHost}/api/v3`;
|
|
95
|
-
this.apiUrl = (apiUrl ?? derived).replace(/\/+$/, '');
|
|
96
|
-
this.host = resolvedHost;
|
|
97
|
-
this.token = token;
|
|
98
|
-
}
|
|
99
|
-
// eslint-disable-next-line class-methods-use-this -- part of the VcsProvider instance contract; GitHub Actions variables are process-global
|
|
100
|
-
getCiContext() {
|
|
101
|
-
return {
|
|
102
|
-
projectPath: process.env.GITHUB_REPOSITORY,
|
|
103
|
-
projectId: process.env.GITHUB_REPOSITORY_ID,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
async listProjects(orgId) {
|
|
107
|
-
const repos = [];
|
|
108
|
-
// GitHub orgs are flat, so there is no subgroup recursion to do here.
|
|
109
|
-
let endpoint = `/orgs/${encodeURIComponent(orgId)}/repos?per_page=100`;
|
|
110
|
-
while (endpoint) {
|
|
111
|
-
// eslint-disable-next-line no-await-in-loop -- pagination is inherently sequential (the next URL comes from this page's Link header)
|
|
112
|
-
const response = await this.request(endpoint);
|
|
113
|
-
// eslint-disable-next-line no-await-in-loop
|
|
114
|
-
const data = (await response.json());
|
|
115
|
-
if (!Array.isArray(data) || data.length === 0) {
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
repos.push(...data);
|
|
119
|
-
endpoint = nextLink(response.headers.get('Link'));
|
|
120
|
-
}
|
|
121
|
-
return repos.map(normalizeProject);
|
|
122
|
-
}
|
|
123
|
-
async getFileContent(project, filePath, ref) {
|
|
124
|
-
const endpoint = `${repoPath(project)}/contents/${encodeFilePath(filePath)}?ref=${encodeURIComponent(ref)}`;
|
|
125
|
-
const response = await this.request(endpoint, { headers: { Accept: 'application/vnd.github.raw' } });
|
|
126
|
-
return response.text();
|
|
127
|
-
}
|
|
128
|
-
async compareRefs(project, from, to) {
|
|
129
|
-
const endpoint = `${repoPath(project)}/compare/${encodeURIComponent(from)}...${encodeURIComponent(to)}`;
|
|
130
|
-
const response = (await this.getJson(endpoint));
|
|
131
|
-
return (response.commits ?? []).map((commit) => ({
|
|
132
|
-
sha: commit.sha,
|
|
133
|
-
message: commit.commit.message,
|
|
134
|
-
raw: commit,
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
async branchExists(project, branchName) {
|
|
138
|
-
const endpoint = `${repoPath(project)}/branches/${encodeURIComponent(branchName)}`;
|
|
139
|
-
try {
|
|
140
|
-
await this.request(endpoint, { method: 'GET' });
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
const err = error;
|
|
145
|
-
if (err.message.includes('404')) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
throw err;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
async createBranch(project, branchName, ref) {
|
|
152
|
-
// GitHub creates refs by SHA, so the source branch has to be resolved first.
|
|
153
|
-
const sourceRef = (await this.getJson(`${repoPath(project)}/git/ref/heads/${encodeURIComponent(ref)}`));
|
|
154
|
-
const response = await this.request(`${repoPath(project)}/git/refs`, {
|
|
155
|
-
method: 'POST',
|
|
156
|
-
body: { ref: `refs/heads/${branchName}`, sha: sourceRef.object.sha },
|
|
157
|
-
});
|
|
158
|
-
const raw = await response.json();
|
|
159
|
-
return { name: branchName, raw };
|
|
160
|
-
}
|
|
161
|
-
async commitFile(project, branchName, commitMessage, filePath, content) {
|
|
162
|
-
const encodedPath = encodeFilePath(filePath);
|
|
163
|
-
// Updating an existing file through the contents API requires its current blob SHA.
|
|
164
|
-
const existing = (await this.getJson(`${repoPath(project)}/contents/${encodedPath}?ref=${encodeURIComponent(branchName)}`));
|
|
165
|
-
const response = await this.request(`${repoPath(project)}/contents/${encodedPath}`, {
|
|
166
|
-
method: 'PUT',
|
|
167
|
-
body: {
|
|
168
|
-
message: commitMessage,
|
|
169
|
-
content: Buffer.from(content, 'utf8').toString('base64'),
|
|
170
|
-
branch: branchName,
|
|
171
|
-
sha: existing.sha,
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
|
-
const raw = (await response.json());
|
|
175
|
-
return { id: raw.commit?.sha, raw };
|
|
176
|
-
}
|
|
177
|
-
async findOpenMergeRequest(project, sourceBranch, targetBranch) {
|
|
178
|
-
const { owner } = splitProject(project);
|
|
179
|
-
const head = `${owner}:${sourceBranch}`;
|
|
180
|
-
const endpoint = `${repoPath(project)}/pulls?state=open&head=${encodeURIComponent(head)}&base=${encodeURIComponent(targetBranch)}`;
|
|
181
|
-
const pullRequests = (await this.getJson(endpoint));
|
|
182
|
-
return pullRequests.length > 0 ? normalizePullRequest(pullRequests[0]) : undefined;
|
|
183
|
-
}
|
|
184
|
-
async createMergeRequest(project, sourceBranch, targetBranch, title, description, labels) {
|
|
185
|
-
// GitLab's `remove_source_branch` has no per-pull-request equivalent here; branch cleanup is
|
|
186
|
-
// the repo-level `delete_branch_on_merge` setting.
|
|
187
|
-
const response = await this.request(`${repoPath(project)}/pulls`, {
|
|
188
|
-
method: 'POST',
|
|
189
|
-
body: { title, body: description, head: sourceBranch, base: targetBranch },
|
|
190
|
-
});
|
|
191
|
-
const pullRequest = normalizePullRequest((await response.json()));
|
|
192
|
-
if (labels?.length) {
|
|
193
|
-
// Labels live on the issue that backs the pull request, not on the pull request itself.
|
|
194
|
-
await this.request(`${repoPath(project)}/issues/${pullRequest.iid}/labels`, {
|
|
195
|
-
method: 'POST',
|
|
196
|
-
body: { labels },
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
return pullRequest;
|
|
200
|
-
}
|
|
201
|
-
async updateMergeRequest(project, mergeRequest, title, description, labels) {
|
|
202
|
-
const response = await this.request(`${repoPath(project)}/pulls/${mergeRequest.iid}`, {
|
|
203
|
-
method: 'PUT',
|
|
204
|
-
body: { title, body: description },
|
|
205
|
-
});
|
|
206
|
-
const updated = normalizePullRequest((await response.json()));
|
|
207
|
-
if (labels?.length) {
|
|
208
|
-
// PUT replaces the label set, matching GitLab's update-with-labels semantics.
|
|
209
|
-
await this.request(`${repoPath(project)}/issues/${updated.iid}/labels`, {
|
|
210
|
-
method: 'PUT',
|
|
211
|
-
body: { labels },
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
return updated;
|
|
215
|
-
}
|
|
216
|
-
async getProjectVariables(project) {
|
|
217
|
-
try {
|
|
218
|
-
const result = (await this.getJson(`${repoPath(project)}/actions/variables`));
|
|
219
|
-
return (result.variables ?? []).map((variable) => ({
|
|
220
|
-
key: variable.name,
|
|
221
|
-
value: variable.value,
|
|
222
|
-
raw: variable,
|
|
223
|
-
}));
|
|
224
|
-
}
|
|
225
|
-
catch {
|
|
226
|
-
// If we don't have permission to read variables, treat it as "no variables".
|
|
227
|
-
return [];
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
// eslint-disable-next-line class-methods-use-this -- part of the VcsProvider instance contract; the path scheme needs no instance state
|
|
231
|
-
buildChangeRequestUrl(projectUrl, changeRequestIid) {
|
|
232
|
-
return `${projectUrl.replace(/\/+$/, '')}/pull/${changeRequestIid}`;
|
|
233
|
-
}
|
|
234
|
-
buildAuthenticatedRemoteUrl(token, projectPath) {
|
|
235
|
-
return `https://x-access-token:${token}@${this.host}/${projectPath}.git`;
|
|
236
|
-
}
|
|
237
|
-
buildCiCloneUrl(ciJobToken, projectPath) {
|
|
238
|
-
// GitHub has no separate job token; Actions hands the workflow a GITHUB_TOKEN that
|
|
239
|
-
// authenticates the same way.
|
|
240
|
-
return `https://x-access-token:${ciJobToken}@${this.host}/${projectPath}.git`;
|
|
241
|
-
}
|
|
242
|
-
async request(endpoint, options = {}) {
|
|
243
|
-
const url = endpoint.startsWith('http') ? endpoint : `${this.apiUrl}${endpoint}`;
|
|
244
|
-
const headers = {
|
|
245
|
-
Authorization: `Bearer ${this.token}`,
|
|
246
|
-
Accept: 'application/vnd.github+json',
|
|
247
|
-
'X-GitHub-Api-Version': '2022-11-28',
|
|
248
|
-
'Content-Type': 'application/json',
|
|
249
|
-
...options.headers,
|
|
250
|
-
};
|
|
251
|
-
const response = await fetch(url, {
|
|
252
|
-
method: options.method,
|
|
253
|
-
headers,
|
|
254
|
-
body: options.body !== undefined ? JSON.stringify(options.body) : undefined,
|
|
255
|
-
});
|
|
256
|
-
if (!response.ok) {
|
|
257
|
-
const errorText = await response.text().catch(() => 'Unknown error');
|
|
258
|
-
throw new Error(`GitHub API error: ${response.status} ${response.statusText} - ${errorText}`);
|
|
259
|
-
}
|
|
260
|
-
return response;
|
|
261
|
-
}
|
|
262
|
-
async getJson(endpoint) {
|
|
263
|
-
const response = await this.request(endpoint);
|
|
264
|
-
return response.json();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
//# sourceMappingURL=github.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/common/vcs/github.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA8CH,SAAS,gBAAgB,CAAC,IAAwB;IAChD,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,GAAG,EAAE,IAAI,CAAC,SAAS;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,iBAAiB,EAAE,IAAI,CAAC,SAAS;QACjC,aAAa,EAAE,IAAI,CAAC,cAAc;QAClC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;QAChC,+EAA+E;QAC/E,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC;QACtB,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;QAC1B,GAAG,EAAE,IAAI;KACV,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,WAAsC;IAClE,OAAO;QACL,EAAE,EAAE,WAAW,CAAC,EAAE;QAClB,qEAAqE;QACrE,GAAG,EAAE,WAAW,CAAC,MAAM;QACvB,KAAK,EAAE,WAAW,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,SAAS;SAC5E,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;YACrE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,SAAS,EAAE,CAAC,CAAC;QAChG,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,QAAgB;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { VcsBranch, VcsCiContext, VcsCommit, VcsCommitLogEntry, VcsMergeRequest, VcsProject, VcsProjectRef, VcsProjectVariable, VcsProvider, VcsProviderOptions, VcsTerminology } from './types.js';
|
|
2
|
-
/** A `VcsProvider` implementation for GitLab, backed by the GitLab REST API v4. */
|
|
3
|
-
export declare class GitLabProvider implements VcsProvider {
|
|
4
|
-
/** Used when no `--vcs-host` is supplied, so selecting a provider is enough to reach its SaaS instance. */
|
|
5
|
-
static readonly defaultHost = "gitlab.com";
|
|
6
|
-
readonly kind: "gitlab";
|
|
7
|
-
readonly terminology: VcsTerminology;
|
|
8
|
-
readonly host: string;
|
|
9
|
-
readonly apiUrl: string;
|
|
10
|
-
private readonly token;
|
|
11
|
-
private readonly tokenKind;
|
|
12
|
-
constructor(options: VcsProviderOptions);
|
|
13
|
-
getCiContext(): VcsCiContext;
|
|
14
|
-
listProjects(groupId: string | number): Promise<VcsProject[]>;
|
|
15
|
-
getFileContent(project: VcsProjectRef, filePath: string, ref: string): Promise<string>;
|
|
16
|
-
compareRefs(project: VcsProjectRef, from: string, to: string): Promise<VcsCommitLogEntry[]>;
|
|
17
|
-
branchExists(project: VcsProjectRef, branchName: string): Promise<boolean>;
|
|
18
|
-
createBranch(project: VcsProjectRef, branchName: string, ref: string): Promise<VcsBranch>;
|
|
19
|
-
commitFile(project: VcsProjectRef, branchName: string, commitMessage: string, filePath: string, content: string): Promise<VcsCommit>;
|
|
20
|
-
findOpenMergeRequest(project: VcsProjectRef, sourceBranch: string, targetBranch: string): Promise<VcsMergeRequest | undefined>;
|
|
21
|
-
createMergeRequest(project: VcsProjectRef, sourceBranch: string, targetBranch: string, title: string, description: string, labels?: string[]): Promise<VcsMergeRequest>;
|
|
22
|
-
updateMergeRequest(project: VcsProjectRef, mergeRequest: VcsMergeRequest, title: string, description: string, labels?: string[]): Promise<VcsMergeRequest>;
|
|
23
|
-
getProjectVariables(project: VcsProjectRef): Promise<VcsProjectVariable[]>;
|
|
24
|
-
buildChangeRequestUrl(projectUrl: string, changeRequestIid: string | number): string;
|
|
25
|
-
buildAuthenticatedRemoteUrl(token: string, projectPath: string): string;
|
|
26
|
-
buildCiCloneUrl(ciJobToken: string, projectPath: string): string;
|
|
27
|
-
private request;
|
|
28
|
-
private getJson;
|
|
29
|
-
private getRawText;
|
|
30
|
-
}
|