@theholocron/holocron-plugin-github 5.0.0-alpha.520 → 5.0.0-alpha.521
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/dist/index.d.mts +5 -1
- package/dist/index.mjs +60 -0
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* receives plugin-level options from `holocron.config.json` and
|
|
8
8
|
* returns the bound implementation.
|
|
9
9
|
*/
|
|
10
|
-
import { AddedItem, Auth, AuthError, BoardItem, BoardItemInput, BoardState, BoardSummary, BoardTemplate, Ci, CiRun, CiRunFilter, EnsureRelaySourceInput, EnsureRelaySourceResult, EnsureReport, Environment, Environments, ExportInfo, ImportOptions, ImportResult, InspectRelaySourceInput, Issue, IssueCreateInput, IssuePatch, IssueRecord, IssueSearchFilter, IssueSelector, IssueTypeDeclaration, IssueTypeInfo, IssueUpdateResult, Issues, LabelDef, LifecycleResult, LifecycleSlot, MoveReport, PagesConfig, PluginToken, Projects, PullRequest, PullRequestChecks, PullRequestInput, PullRequestPatch, PullRequestResult, RelaySourceState, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretAccess, SecretScope, Secrets, Source, SourceBranch, SourceFile, SourceRepoInfo, SourceRulesetDetail, SourceSecurity, SourceTeamMember, SyncResult, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TeamPermission as TeamPermission$1, TrackerDoctorReport, TrackerUser, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, createFeatureResolver } from "@theholocron/cli";
|
|
10
|
+
import { AddedItem, Auth, AuthError, BoardItem, BoardItemInput, BoardState, BoardSummary, BoardTemplate, Ci, CiRun, CiRunFilter, EnsureRelaySourceInput, EnsureRelaySourceResult, EnsureReport, Environment, Environments, ExportInfo, ImportOptions, ImportResult, InspectRelaySourceInput, Issue, IssueCreateInput, IssuePatch, IssueRecord, IssueSearchFilter, IssueSelector, IssueTypeDeclaration, IssueTypeInfo, IssueUpdateResult, Issues, LabelDef, LifecycleResult, LifecycleSlot, MoveReport, PagesConfig, PluginToken, Projects, PullRequest, PullRequestChecks, PullRequestInput, PullRequestPatch, PullRequestResult, RelaySourceState, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretAccess, SecretScope, Secrets, Source, SourceBranch, SourceCheckRun, SourceCheckRunWrite, SourceCommitStatus, SourceFile, SourceRepoInfo, SourceRulesetDetail, SourceSecurity, SourceTeamMember, SyncResult, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TeamPermission as TeamPermission$1, TrackerDoctorReport, TrackerUser, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, createFeatureResolver } from "@theholocron/cli";
|
|
11
11
|
import { GitHubClient, GitHubClientOptions, GraphQLClient, createGitHubClient } from "@theholocron/github-client";
|
|
12
12
|
/** Resolves the token for read-only GitHub access (`HOLOCRON_READ_TOKEN`, keyring key `github.read`). */
|
|
13
13
|
export declare const resolveReadToken: import("@theholocron/cli").FeatureResolver;
|
|
@@ -421,6 +421,10 @@ export declare class GitHubSource implements Source {
|
|
|
421
421
|
updatePullRequest(number: number, patch: PullRequestPatch, repo?: string): Promise<PullRequestResult>;
|
|
422
422
|
markReady(number: number, repo?: string): Promise<boolean>;
|
|
423
423
|
getPullRequestChecks(number: number, repo?: string): Promise<PullRequestChecks>;
|
|
424
|
+
listCheckRuns(ref: string, repo?: string): Promise<SourceCheckRun[]>;
|
|
425
|
+
listCommitStatuses(ref: string, repo?: string): Promise<SourceCommitStatus[]>;
|
|
426
|
+
createCheckRun(sha: string, name: string, write: SourceCheckRunWrite, repo?: string): Promise<number>;
|
|
427
|
+
updateCheckRun(id: number, write: SourceCheckRunWrite, repo?: string): Promise<void>;
|
|
424
428
|
configurePages(config: PagesConfig, token: string): Promise<void>;
|
|
425
429
|
}
|
|
426
430
|
/** A team entry with the permission spelled out. */
|
package/dist/index.mjs
CHANGED
|
@@ -2031,6 +2031,54 @@ function toGHScope(scope) {
|
|
|
2031
2031
|
};
|
|
2032
2032
|
return scope;
|
|
2033
2033
|
}
|
|
2034
|
+
// src/capabilities/check-runs.ts
|
|
2035
|
+
/** Every check run on a commit in the plain shape the CLI reads (the aggregate's own included). */
|
|
2036
|
+
async function readCheckRuns(client, repo, ref) {
|
|
2037
|
+
return (await client.checks.listCheckRunsForRef(repo, ref)).map((run) => ({
|
|
2038
|
+
id: run.id,
|
|
2039
|
+
name: run.name,
|
|
2040
|
+
status: run.status,
|
|
2041
|
+
conclusion: run.conclusion,
|
|
2042
|
+
startedAt: run.started_at ?? null,
|
|
2043
|
+
url: run.details_url ?? run.html_url,
|
|
2044
|
+
appSlug: run.app?.slug ?? null
|
|
2045
|
+
}));
|
|
2046
|
+
}
|
|
2047
|
+
/** The commit statuses on a commit, newest first, in the plain shape the CLI reads. */
|
|
2048
|
+
async function readCommitStatuses(client, repo, ref) {
|
|
2049
|
+
return (await client.statuses.listCommitStatuses(repo, ref)).map((status) => ({
|
|
2050
|
+
context: status.context,
|
|
2051
|
+
state: status.state,
|
|
2052
|
+
url: status.target_url
|
|
2053
|
+
}));
|
|
2054
|
+
}
|
|
2055
|
+
/** GitHub's `output` for a write: the title and summary, and the details only when there are some. */
|
|
2056
|
+
function outputFor(write) {
|
|
2057
|
+
return {
|
|
2058
|
+
title: write.title,
|
|
2059
|
+
summary: write.summary,
|
|
2060
|
+
...write.text === "" ? {} : { text: write.text }
|
|
2061
|
+
};
|
|
2062
|
+
}
|
|
2063
|
+
/** Posts a check run on a commit and returns its id. */
|
|
2064
|
+
async function postCheckRun(client, repo, sha, name, write) {
|
|
2065
|
+
return (await client.checks.createCheckRun(repo, {
|
|
2066
|
+
name,
|
|
2067
|
+
head_sha: sha,
|
|
2068
|
+
status: write.status,
|
|
2069
|
+
...write.conclusion === void 0 ? {} : { conclusion: write.conclusion },
|
|
2070
|
+
output: outputFor(write),
|
|
2071
|
+
...write.startedAt === void 0 ? {} : { started_at: write.startedAt }
|
|
2072
|
+
})).id;
|
|
2073
|
+
}
|
|
2074
|
+
/** Changes a check run: its state, verdict and output. */
|
|
2075
|
+
async function patchCheckRun(client, repo, id, write) {
|
|
2076
|
+
await client.checks.updateCheckRun(repo, id, {
|
|
2077
|
+
status: write.status,
|
|
2078
|
+
...write.conclusion === void 0 ? {} : { conclusion: write.conclusion },
|
|
2079
|
+
output: outputFor(write)
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2034
2082
|
// src/capabilities/files.ts
|
|
2035
2083
|
/** Reads one file; `null` when it does not exist. `version` is the blob sha `writeFile` needs to replace exactly this one. */
|
|
2036
2084
|
/** A fine-grained token only reaches the repositories and permissions it was given; say which one is missing. */
|
|
@@ -3017,6 +3065,18 @@ var GitHubSource = class {
|
|
|
3017
3065
|
async getPullRequestChecks(number, repo) {
|
|
3018
3066
|
return readPullRequestChecks(this.client, repo ?? this.repo, number);
|
|
3019
3067
|
}
|
|
3068
|
+
async listCheckRuns(ref, repo) {
|
|
3069
|
+
return readCheckRuns(this.client, repo ?? this.repo, ref);
|
|
3070
|
+
}
|
|
3071
|
+
async listCommitStatuses(ref, repo) {
|
|
3072
|
+
return readCommitStatuses(this.client, repo ?? this.repo, ref);
|
|
3073
|
+
}
|
|
3074
|
+
async createCheckRun(sha, name, write, repo) {
|
|
3075
|
+
return postCheckRun(this.client, repo ?? this.repo, sha, name, write);
|
|
3076
|
+
}
|
|
3077
|
+
async updateCheckRun(id, write, repo) {
|
|
3078
|
+
return patchCheckRun(this.client, repo ?? this.repo, id, write);
|
|
3079
|
+
}
|
|
3020
3080
|
async configurePages(config, token) {
|
|
3021
3081
|
const pagesClient = createGitHubClient$1({
|
|
3022
3082
|
token,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-github",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.521",
|
|
4
4
|
"description": "Holocron plugin for GitHub. Implements source, ci, secrets, environments, and issues capabilities against the GitHub REST API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -44,21 +44,21 @@
|
|
|
44
44
|
"tsx": "4.23.15",
|
|
45
45
|
"typescript": "^6.0.3",
|
|
46
46
|
"vitest": "^5.1.0",
|
|
47
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
47
|
+
"@theholocron/cli": "5.0.0-alpha.521",
|
|
48
48
|
"@theholocron/eslint-config": "^8.9.0-alpha.22",
|
|
49
49
|
"@theholocron/fs-utils": "^1.17.0-alpha.5",
|
|
50
|
-
"@theholocron/
|
|
51
|
-
"@theholocron/http-client": "^1.58.0-alpha.52",
|
|
50
|
+
"@theholocron/http-client": "^1.58.0-alpha.53",
|
|
52
51
|
"@theholocron/tsconfig": "^8.9.0-alpha.22",
|
|
53
|
-
"@theholocron/github-client": "^1.58.0-alpha.
|
|
52
|
+
"@theholocron/github-client": "^1.58.0-alpha.53",
|
|
53
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.22",
|
|
54
54
|
"@theholocron/vitest-config": "^8.9.0-alpha.22",
|
|
55
|
-
"@theholocron/
|
|
55
|
+
"@theholocron/misc-utils": "^1.17.0-alpha.5"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@theholocron/fs-utils": "^1.16.0",
|
|
59
59
|
"@theholocron/github-client": "^1.58.0",
|
|
60
60
|
"@theholocron/misc-utils": "^1.16.0",
|
|
61
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
61
|
+
"@theholocron/cli": "5.0.0-alpha.521"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22"
|