@theholocron/holocron-plugin-github 5.0.0-alpha.520 → 5.0.0-alpha.522
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 +66 -2
- 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. */
|
|
@@ -2455,15 +2503,19 @@ async function readRepoInfo(client, repo) {
|
|
|
2455
2503
|
settings
|
|
2456
2504
|
};
|
|
2457
2505
|
}
|
|
2458
|
-
/** A ruleset reduced to what `setup` writes: its enforcement, rule types
|
|
2506
|
+
/** A ruleset reduced to what `setup` writes: its enforcement, rule types, required status checks and the app a check is pinned to. */
|
|
2459
2507
|
function toRulesetDetail(data) {
|
|
2460
2508
|
const rules = data.rules ?? [];
|
|
2461
2509
|
const checks = rules.find((r) => r.type === "required_status_checks")?.parameters?.required_status_checks;
|
|
2510
|
+
const entries = Array.isArray(checks) ? checks : [];
|
|
2511
|
+
const sources = {};
|
|
2512
|
+
for (const entry of entries) if (typeof entry.integration_id === "number") sources[String(entry.context)] = entry.integration_id;
|
|
2462
2513
|
return {
|
|
2463
2514
|
name: data.name,
|
|
2464
2515
|
enforcement: data.enforcement,
|
|
2465
2516
|
ruleTypes: rules.map((r) => r.type),
|
|
2466
|
-
requiredChecks:
|
|
2517
|
+
requiredChecks: entries.map((c) => String(c.context)),
|
|
2518
|
+
...Object.keys(sources).length > 0 ? { requiredCheckSources: sources } : {}
|
|
2467
2519
|
};
|
|
2468
2520
|
}
|
|
2469
2521
|
/** The value, or `undefined` when GitHub refuses the read (permission, plan, feature absent). Other errors still throw. */
|
|
@@ -3017,6 +3069,18 @@ var GitHubSource = class {
|
|
|
3017
3069
|
async getPullRequestChecks(number, repo) {
|
|
3018
3070
|
return readPullRequestChecks(this.client, repo ?? this.repo, number);
|
|
3019
3071
|
}
|
|
3072
|
+
async listCheckRuns(ref, repo) {
|
|
3073
|
+
return readCheckRuns(this.client, repo ?? this.repo, ref);
|
|
3074
|
+
}
|
|
3075
|
+
async listCommitStatuses(ref, repo) {
|
|
3076
|
+
return readCommitStatuses(this.client, repo ?? this.repo, ref);
|
|
3077
|
+
}
|
|
3078
|
+
async createCheckRun(sha, name, write, repo) {
|
|
3079
|
+
return postCheckRun(this.client, repo ?? this.repo, sha, name, write);
|
|
3080
|
+
}
|
|
3081
|
+
async updateCheckRun(id, write, repo) {
|
|
3082
|
+
return patchCheckRun(this.client, repo ?? this.repo, id, write);
|
|
3083
|
+
}
|
|
3020
3084
|
async configurePages(config, token) {
|
|
3021
3085
|
const pagesClient = createGitHubClient$1({
|
|
3022
3086
|
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.522",
|
|
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.
|
|
48
|
-
"@theholocron/eslint-config": "^8.9.0-alpha.22",
|
|
47
|
+
"@theholocron/cli": "5.0.0-alpha.522",
|
|
49
48
|
"@theholocron/fs-utils": "^1.17.0-alpha.5",
|
|
50
49
|
"@theholocron/misc-utils": "^1.17.0-alpha.5",
|
|
51
|
-
"@theholocron/
|
|
50
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.22",
|
|
52
51
|
"@theholocron/tsconfig": "^8.9.0-alpha.22",
|
|
53
|
-
"@theholocron/
|
|
52
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.22",
|
|
54
53
|
"@theholocron/vitest-config": "^8.9.0-alpha.22",
|
|
55
|
-
"@theholocron/
|
|
54
|
+
"@theholocron/github-client": "^1.58.0-alpha.53",
|
|
55
|
+
"@theholocron/http-client": "^1.58.0-alpha.53"
|
|
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.522"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22"
|