@fitlab-ai/agent-infra 0.9.12 → 0.9.13
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/README.md +11 -11
- package/README.zh-CN.md +11 -11
- package/dist/bin/internal-cli.js +24 -19
- package/dist/lib/agent-clients/next-steps.js +6 -1
- package/dist/lib/decide.js +3 -3
- package/dist/lib/internal/platform-checks.js +3 -3
- package/dist/lib/internal/platform-comment.js +9 -9
- package/dist/lib/internal/platform-context.js +2 -2
- package/dist/lib/internal/platform-issue.js +8 -9
- package/dist/lib/internal/platform-pr-review.js +10 -10
- package/dist/lib/internal/platform-pr.js +63 -24
- package/dist/lib/internal/platform-release-notes.js +3 -3
- package/dist/lib/internal/pr-review-grade.js +11 -9
- package/dist/lib/internal/release-workflow.js +4 -4
- package/dist/lib/internal/sandbox-control.js +30 -4
- package/dist/lib/internal/task-activity.js +3 -3
- package/dist/lib/internal/task-artifact.js +76 -24
- package/dist/lib/internal/task-create.js +2 -2
- package/dist/lib/internal/task-event.js +6 -3
- package/dist/lib/internal/task-finalization.js +2 -2
- package/dist/lib/internal/task-invalidation.js +60 -0
- package/dist/lib/internal/task-ledger.js +9 -6
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-override.js +4 -4
- package/dist/lib/internal/task-review.js +3 -3
- package/dist/lib/internal/task-verify.js +6 -6
- package/dist/lib/internal/task-warning.js +3 -3
- package/dist/lib/platform/adapters.js +1 -3
- package/dist/lib/platform/change-request-git-evidence.js +27 -7
- package/dist/lib/platform/completion-backfill.js +6 -5
- package/dist/lib/platform/context.js +70 -130
- package/dist/lib/platform/github-client.js +1 -1
- package/dist/lib/platform/github-provider.js +903 -0
- package/dist/lib/platform/in-label-sync.js +143 -0
- package/dist/lib/platform/issue-comments.js +94 -41
- package/dist/lib/platform/issues.js +335 -189
- package/dist/lib/platform/metadata-labels.js +6 -2
- package/dist/lib/platform/none-provider.js +28 -0
- package/dist/lib/platform/pr-change-report.js +551 -0
- package/dist/lib/platform/pr-checks.js +119 -104
- package/dist/lib/platform/pr-review.js +88 -72
- package/dist/lib/platform/pr-summary.js +520 -50
- package/dist/lib/platform/provider-bridge.js +45 -0
- package/dist/lib/platform/provider-contract.d.ts +487 -0
- package/dist/lib/platform/provider-contract.js +95 -0
- package/dist/lib/platform/provider-loader.js +251 -0
- package/dist/lib/platform/provider-validation.js +504 -0
- package/dist/lib/platform/pull-request-metadata.js +8 -6
- package/dist/lib/platform/pull-requests.js +783 -537
- package/dist/lib/platform/release-notes.js +78 -55
- package/dist/lib/platform/releases.js +79 -50
- package/dist/lib/platform/resource-identity.d.ts +26 -0
- package/dist/lib/platform/resource-identity.js +92 -0
- package/dist/lib/platform/task-identities.js +31 -0
- package/dist/lib/platform/verification-required.js +11 -12
- package/dist/lib/platform/verification-sync.js +112 -238
- package/dist/lib/pr-review/evidence-grading.js +19 -6
- package/dist/lib/run/index.js +63 -23
- package/dist/lib/sandbox/control/client.js +96 -15
- package/dist/lib/sandbox/control/executor.js +3 -3
- package/dist/lib/sandbox/control/protocol.js +77 -0
- package/dist/lib/sandbox/control/server.js +398 -25
- package/dist/lib/sandbox/control/state.js +204 -1
- package/dist/lib/server/protocol.js +38 -1
- package/dist/lib/task/activity-log.js +8 -1
- package/dist/lib/task/artifact-lifecycle.js +33 -5
- package/dist/lib/task/capabilities.js +239 -0
- package/dist/lib/task/commands/status.js +32 -0
- package/dist/lib/task/commit-operation.js +12 -1
- package/dist/lib/task/control-authority.js +8 -5
- package/dist/lib/task/create-service.js +8 -8
- package/dist/lib/task/current-contract.js +5 -1
- package/dist/lib/task/decision-details.js +1 -1
- package/dist/lib/task/events.js +297 -17
- package/dist/lib/task/finalization.js +37 -13
- package/dist/lib/task/human-override.js +58 -36
- package/dist/lib/task/invalidation-command.js +86 -0
- package/dist/lib/task/invalidation.js +260 -0
- package/dist/lib/task/ledger-intents.js +37 -0
- package/dist/lib/task/local-artifact-finalization.js +374 -0
- package/dist/lib/task/orchestration.js +49 -93
- package/dist/lib/task/pr-delivery-fact.js +102 -101
- package/dist/lib/task/review-fingerprint.js +24 -2
- package/dist/lib/task/rework-intent.js +138 -0
- package/dist/lib/task/skill-scope.js +23 -0
- package/dist/lib/task/task-execution-lock.js +27 -17
- package/dist/lib/task/verification-engine.js +43 -16
- package/dist/lib/task/verification.js +3 -3
- package/dist/lib/task/workflow-warning-intents.js +1 -1
- package/dist/lib/task/write.js +11 -0
- package/dist/lib/version.js +11 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/next-steps.ts +6 -1
- package/lib/decide.ts +3 -3
- package/lib/init.ts +1 -1
- package/lib/internal/platform-checks.ts +3 -3
- package/lib/internal/platform-comment.ts +8 -8
- package/lib/internal/platform-context.ts +2 -2
- package/lib/internal/platform-issue.ts +7 -8
- package/lib/internal/platform-pr-review.ts +9 -9
- package/lib/internal/platform-pr.ts +47 -22
- package/lib/internal/platform-release-notes.ts +3 -3
- package/lib/internal/pr-review-grade.ts +10 -8
- package/lib/internal/release-workflow.ts +4 -4
- package/lib/internal/sandbox-control.ts +27 -3
- package/lib/internal/task-activity.ts +3 -3
- package/lib/internal/task-artifact.ts +65 -22
- package/lib/internal/task-create.ts +2 -2
- package/lib/internal/task-event.ts +6 -3
- package/lib/internal/task-finalization.ts +3 -3
- package/lib/internal/task-invalidation.ts +39 -0
- package/lib/internal/task-ledger.ts +11 -8
- package/lib/internal/task-lifecycle.ts +2 -2
- package/lib/internal/task-override.ts +6 -6
- package/lib/internal/task-review.ts +3 -3
- package/lib/internal/task-verify.ts +6 -6
- package/lib/internal/task-warning.ts +3 -3
- package/lib/platform/adapters.ts +3 -2
- package/lib/platform/change-request-git-evidence.ts +36 -9
- package/lib/platform/completion-backfill.ts +9 -8
- package/lib/platform/context.ts +97 -134
- package/lib/platform/github-client.ts +2 -2
- package/lib/platform/github-provider.ts +910 -0
- package/lib/platform/in-label-sync.ts +208 -0
- package/lib/platform/issue-comments.ts +97 -47
- package/lib/platform/issues.ts +344 -174
- package/lib/platform/metadata-labels.ts +5 -2
- package/lib/platform/none-provider.ts +35 -0
- package/lib/platform/pr-change-report.ts +645 -0
- package/lib/platform/pr-checks.ts +126 -106
- package/lib/platform/pr-review.ts +88 -85
- package/lib/platform/pr-summary.ts +560 -53
- package/lib/platform/provider-bridge.ts +82 -0
- package/lib/platform/provider-contract.ts +536 -0
- package/lib/platform/provider-loader.ts +307 -0
- package/lib/platform/provider-validation.ts +529 -0
- package/lib/platform/pull-request-metadata.ts +10 -7
- package/lib/platform/pull-requests.ts +826 -543
- package/lib/platform/release-notes.ts +76 -59
- package/lib/platform/releases.ts +77 -43
- package/lib/platform/resource-identity.ts +121 -0
- package/lib/platform/task-identities.ts +40 -0
- package/lib/platform/types.ts +4 -2
- package/lib/platform/verification-required.ts +11 -13
- package/lib/platform/verification-sync.ts +112 -292
- package/lib/pr-review/evidence-grading.ts +25 -8
- package/lib/run/index.ts +57 -22
- package/lib/sandbox/control/client.ts +105 -15
- package/lib/sandbox/control/executor.ts +4 -4
- package/lib/sandbox/control/protocol.ts +113 -0
- package/lib/sandbox/control/server.ts +431 -23
- package/lib/sandbox/control/state.ts +251 -1
- package/lib/server/protocol.ts +36 -1
- package/lib/task/activity-log.ts +8 -0
- package/lib/task/artifact-lifecycle.ts +32 -6
- package/lib/task/capabilities.ts +262 -0
- package/lib/task/commands/status.ts +38 -0
- package/lib/task/commit-operation.ts +12 -1
- package/lib/task/control-authority.ts +11 -8
- package/lib/task/create-service.ts +8 -8
- package/lib/task/current-contract.ts +6 -1
- package/lib/task/decision-details.ts +6 -2
- package/lib/task/events.ts +296 -16
- package/lib/task/finalization.ts +50 -14
- package/lib/task/human-override.ts +70 -46
- package/lib/task/invalidation-command.ts +86 -0
- package/lib/task/invalidation.ts +332 -0
- package/lib/task/ledger-intents.ts +35 -1
- package/lib/task/local-artifact-finalization.ts +563 -0
- package/lib/task/orchestration.ts +52 -85
- package/lib/task/pr-delivery-fact.ts +131 -148
- package/lib/task/review-fingerprint.ts +23 -2
- package/lib/task/rework-intent.ts +165 -0
- package/lib/task/skill-scope.ts +24 -0
- package/lib/task/task-execution-lock.ts +23 -14
- package/lib/task/verification-engine.ts +52 -17
- package/lib/task/verification.ts +4 -4
- package/lib/task/workflow-warning-intents.ts +1 -1
- package/lib/task/write.ts +19 -0
- package/lib/update.ts +1 -1
- package/lib/version.ts +15 -1
- package/package.json +7 -1
- package/templates/.agents/rules/README.en.md +1 -1
- package/templates/.agents/rules/README.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +2 -0
- package/templates/.agents/rules/issue-sync.zh-CN.md +2 -0
- package/templates/.agents/rules/local-artifact-repair.en.md +9 -2
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +9 -2
- package/templates/.agents/rules/pr-sync.en.md +10 -4
- package/templates/.agents/rules/pr-sync.zh-CN.md +17 -4
- package/templates/.agents/rules/task-short-id.en.md +1 -4
- package/templates/.agents/rules/task-short-id.zh-CN.md +1 -3
- package/templates/.agents/skills/analyze-task/SKILL.en.md +13 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +10 -3
- package/templates/.agents/skills/check-task/SKILL.en.md +16 -37
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -37
- package/templates/.agents/skills/code-task/SKILL.en.md +27 -8
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +29 -10
- package/templates/.agents/skills/code-task/config/verify.en.json +1 -0
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +2 -0
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +2 -0
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +3 -3
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +3 -3
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -3
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +4 -3
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +4 -3
- package/templates/.agents/skills/complete-task/SKILL.en.md +21 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +20 -3
- package/templates/.agents/skills/create-pr/SKILL.en.md +7 -6
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +7 -7
- package/templates/.agents/skills/create-pr/config/verify.json +1 -0
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +16 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +16 -4
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +5 -3
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +5 -3
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +3 -0
- package/templates/.agents/skills/plan-task/SKILL.en.md +13 -3
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +10 -3
- package/templates/.agents/skills/review-analysis/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/review-code/SKILL.en.md +4 -4
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/review-plan/SKILL.en.md +3 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +4 -2
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +4 -2
- package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +6 -0
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +6 -0
- package/templates/.agents/templates/task.en.md +18 -1
- package/templates/.agents/templates/task.zh-CN.md +18 -1
- package/templates/.github/workflows/pr-label.yml +7 -26
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { parseTypedTaskFrontmatter } from '../task/frontmatter.js';
|
|
3
3
|
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
4
|
-
import {
|
|
5
|
-
import { resolvePlatformContext } from './context.js';
|
|
6
|
-
import { createGitHubClient } from './github-client.js';
|
|
4
|
+
import { resolvePlatformProviderContext } from './context.js';
|
|
7
5
|
import { inspectPlatformPullRequest } from './pull-requests.js';
|
|
8
6
|
import { platformResult } from './types.js';
|
|
9
7
|
import { readPrDeliveryFact } from '../task/pr-delivery-fact.js';
|
|
8
|
+
import { providerError, providerOperationContext, providerStatus, resourceIdentity, resourceIdentityNumber, unsupportedProviderOperation } from './provider-bridge.js';
|
|
10
9
|
function classifyRequiredChecks(required) {
|
|
11
10
|
if (required.length === 0)
|
|
12
11
|
return { state: 'no-required', required };
|
|
@@ -56,7 +55,7 @@ function checksResult(status, overrides = {}) {
|
|
|
56
55
|
};
|
|
57
56
|
}
|
|
58
57
|
function normalizeBucket(value) {
|
|
59
|
-
const raw = String(value.bucket || value.conclusion || value.state || '').toLowerCase();
|
|
58
|
+
const raw = String(value.bucket || value.status || value.conclusion || value.state || '').toLowerCase();
|
|
60
59
|
if (['pass', 'success', 'successful', 'neutral'].includes(raw))
|
|
61
60
|
return 'pass';
|
|
62
61
|
if (['fail', 'failure', 'failed', 'error', 'timed_out', 'action_required'].includes(raw))
|
|
@@ -82,85 +81,83 @@ function normalizeChecks(value) {
|
|
|
82
81
|
}] : [];
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
function resolvedTask(taskRef, options) {
|
|
84
|
+
function inspectGitHubRequiredChecks(client, repository, number, cwd) {
|
|
85
|
+
const inspected = client.json([
|
|
86
|
+
'pr', 'checks', String(number), '--repo', repository,
|
|
87
|
+
'--json', 'name,state,bucket,link,workflow,startedAt,completedAt'
|
|
88
|
+
], { cwd });
|
|
89
|
+
return inspected.ok
|
|
90
|
+
? { ok: true, value: normalizeChecks(inspected.value) }
|
|
91
|
+
: { ok: false, error: inspected.error };
|
|
92
|
+
}
|
|
93
|
+
async function resolvedTask(taskRef, options) {
|
|
98
94
|
const resolved = resolveTaskRef(taskRef, options.cwd ? { repoRoot: options.cwd } : {});
|
|
99
95
|
if (!resolved.ok)
|
|
100
96
|
return { ok: false, output: checksResult('failed', { error: { code: resolved.code, message: resolved.message, retryable: false } }) };
|
|
101
97
|
const frontmatter = parseTypedTaskFrontmatter(fs.readFileSync(resolved.taskMdPath, 'utf8'));
|
|
102
|
-
const fact = readPrDeliveryFact(frontmatter);
|
|
98
|
+
const fact = readPrDeliveryFact(frontmatter, options.runtimeVersion);
|
|
103
99
|
if (fact.status === 'invalid')
|
|
104
|
-
return { ok: false, output: checksResult('failed', { error: { code:
|
|
105
|
-
const
|
|
106
|
-
|
|
100
|
+
return { ok: false, output: checksResult('failed', { error: { code: fact.error.code, message: fact.error.message, retryable: false } }) };
|
|
101
|
+
const prIdentity = fact.status === 'valid' && fact.fact.state === 'bound' ? fact.fact.identity.resource : null;
|
|
102
|
+
const prNumber = resourceIdentityNumber(prIdentity);
|
|
103
|
+
if (!prIdentity)
|
|
107
104
|
return { ok: false, output: checksResult('failed', { error: { code: fact.status === 'missing' ? 'PR_DELIVERY_FACT_MISSING' : 'PR_NOT_LINKED', message: 'Task has no verified bound pull request', retryable: false } }) };
|
|
108
|
-
const
|
|
109
|
-
const context =
|
|
105
|
+
const loaded = await resolvePlatformProviderContext({ cwd: resolved.repoRoot, client: options.client });
|
|
106
|
+
const context = loaded.ok ? loaded.value.context : loaded.context;
|
|
110
107
|
if (!context.platform.repository || !['no-op', 'degraded'].includes(context.status))
|
|
111
108
|
return { ok: false, output: checksResult(context.status, { platform: context.platform, capabilities: context.capabilities, error: context.error }) };
|
|
112
|
-
const inspected = inspectPlatformPullRequest(taskRef, { cwd: resolved.repoRoot, client });
|
|
109
|
+
const inspected = await inspectPlatformPullRequest(taskRef, { cwd: resolved.repoRoot, client: options.client });
|
|
113
110
|
if (!inspected.pullRequest)
|
|
114
111
|
return { ok: false, output: checksResult(inspected.status, { platform: context.platform, capabilities: context.capabilities, error: inspected.error }) };
|
|
115
|
-
|
|
112
|
+
if (!loaded.ok)
|
|
113
|
+
return { ok: false, output: checksResult('failed', { platform: context.platform, capabilities: context.capabilities, error: context.error }) };
|
|
114
|
+
return { ok: true, resolved, prNumber, prIdentity, client: options.client, context, pullRequest: inspected.pullRequest, provider: loaded.value.provider, loadedContext: loaded.value };
|
|
116
115
|
}
|
|
117
|
-
function inspectRequiredChecks(taskRef, options = {}) {
|
|
118
|
-
const base = resolvedTask(taskRef, options);
|
|
116
|
+
async function inspectRequiredChecks(taskRef, options = {}) {
|
|
117
|
+
const base = await resolvedTask(taskRef, options);
|
|
119
118
|
if (!base.ok)
|
|
120
119
|
return base.output;
|
|
121
120
|
return inspectChecksForResolvedTask(base, options);
|
|
122
121
|
}
|
|
123
|
-
function inspectChecksForResolvedTask(base, options) {
|
|
122
|
+
async function inspectChecksForResolvedTask(base, options) {
|
|
124
123
|
const repository = base.context.platform.repository;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
124
|
+
{
|
|
125
|
+
const inspected = base.provider.checks?.inspectRequired
|
|
126
|
+
? await base.provider.checks.inspectRequired({
|
|
127
|
+
context: providerOperationContext(base.loadedContext),
|
|
128
|
+
changeRequest: base.prIdentity,
|
|
129
|
+
headSha: base.pullRequest.head.sha
|
|
130
|
+
})
|
|
131
|
+
: unsupportedProviderOperation(base.provider, 'checks.inspectRequired');
|
|
132
|
+
if (!inspected.ok)
|
|
133
|
+
return checksResult(providerStatus(inspected.error), {
|
|
134
|
+
platform: base.context.platform,
|
|
135
|
+
capabilities: base.context.capabilities,
|
|
136
|
+
resource: { kind: 'pull-request', number: base.prNumber },
|
|
137
|
+
pullRequest: base.pullRequest,
|
|
138
|
+
error: providerError(inspected.error, 'PLATFORM_PROVIDER_OPERATION_FAILED')
|
|
139
|
+
});
|
|
140
|
+
const required = normalizeChecks(inspected.value);
|
|
141
|
+
const classified = classifyRequiredChecks(required);
|
|
142
|
+
const status = classified.state === 'passed' || classified.state === 'no-required'
|
|
143
|
+
? 'no-op'
|
|
144
|
+
: classified.state === 'failed' || classified.state === 'cancelled' ? 'failed' : 'blocked';
|
|
145
|
+
return checksResult(status, {
|
|
139
146
|
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
140
|
-
resource: { kind: 'pull-request', number: base.prNumber },
|
|
141
|
-
|
|
147
|
+
resource: { kind: 'pull-request', number: base.prNumber }, pullRequest: base.pullRequest,
|
|
148
|
+
checks: classified,
|
|
149
|
+
error: status === 'no-op' ? null : {
|
|
150
|
+
code: classified.state === 'pending' ? 'REQUIRED_CHECKS_PENDING' : `REQUIRED_CHECKS_${classified.state.toUpperCase()}`,
|
|
151
|
+
message: `Required checks are ${classified.state}`, retryable: classified.state === 'pending'
|
|
152
|
+
}
|
|
142
153
|
});
|
|
143
154
|
}
|
|
144
|
-
const classified = classifyRequiredChecks(inspected.value);
|
|
145
|
-
const status = classified.state === 'passed' || classified.state === 'no-required'
|
|
146
|
-
? 'no-op'
|
|
147
|
-
: classified.state === 'failed' || classified.state === 'cancelled' ? 'failed' : 'blocked';
|
|
148
|
-
return checksResult(status, {
|
|
149
|
-
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
150
|
-
resource: { kind: 'pull-request', number: base.prNumber },
|
|
151
|
-
pullRequest: base.pullRequest, checks: classified,
|
|
152
|
-
error: status === 'no-op' ? null : {
|
|
153
|
-
code: classified.state === 'pending' ? 'REQUIRED_CHECKS_PENDING' : `REQUIRED_CHECKS_${classified.state.toUpperCase()}`,
|
|
154
|
-
message: `Required checks are ${classified.state}`,
|
|
155
|
-
retryable: classified.state === 'pending'
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
155
|
}
|
|
159
|
-
function inspectPullRequestReadiness(taskRef, options = {}) {
|
|
160
|
-
const base = resolvedTask(taskRef, options);
|
|
156
|
+
async function inspectPullRequestReadiness(taskRef, options = {}) {
|
|
157
|
+
const base = await resolvedTask(taskRef, options);
|
|
161
158
|
if (!base.ok)
|
|
162
159
|
return base.output;
|
|
163
|
-
const checked = inspectChecksForResolvedTask(base, options);
|
|
160
|
+
const checked = await inspectChecksForResolvedTask(base, options);
|
|
164
161
|
const classifiedCodes = new Set(['REQUIRED_CHECKS_PENDING', 'REQUIRED_CHECKS_FAILED', 'REQUIRED_CHECKS_CANCELLED']);
|
|
165
162
|
if (checked.error && !classifiedCodes.has(checked.error.code))
|
|
166
163
|
return checked;
|
|
@@ -197,7 +194,7 @@ async function watchPullRequestReadiness(taskRef, options) {
|
|
|
197
194
|
readiness: { state: 'cancelled', headSha: last?.pullRequest?.head.sha ?? '' },
|
|
198
195
|
error: { code: 'PR_READINESS_CANCELLED', message: 'Pull request readiness watch was cancelled', retryable: false }
|
|
199
196
|
});
|
|
200
|
-
last = inspectPullRequestReadiness(taskRef, options);
|
|
197
|
+
last = await inspectPullRequestReadiness(taskRef, options);
|
|
201
198
|
if (last.readiness?.state !== 'pending' || last.error?.code !== 'PR_READINESS_PENDING')
|
|
202
199
|
return last;
|
|
203
200
|
const elapsed = now() - started;
|
|
@@ -211,60 +208,78 @@ async function watchPullRequestReadiness(taskRef, options) {
|
|
|
211
208
|
await sleep(Math.min(options.intervalSeconds * 1000, options.deadlineSeconds * 1000 - elapsed));
|
|
212
209
|
}
|
|
213
210
|
}
|
|
214
|
-
function resolvePlatformCheckRun(taskRef, options) {
|
|
215
|
-
const base = resolvedTask(taskRef, options);
|
|
211
|
+
async function resolvePlatformCheckRun(taskRef, options) {
|
|
212
|
+
const base = await resolvedTask(taskRef, options);
|
|
216
213
|
if (!base.ok)
|
|
217
214
|
return base.output;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
215
|
+
{
|
|
216
|
+
const resolved = base.provider.checks?.resolveRun
|
|
217
|
+
? await base.provider.checks.resolveRun({
|
|
218
|
+
context: providerOperationContext(base.loadedContext),
|
|
219
|
+
changeRequest: base.prIdentity,
|
|
220
|
+
checkName: options.checkName,
|
|
221
|
+
...(options.detailsUrl ? { detailsUrl: options.detailsUrl } : {})
|
|
222
|
+
})
|
|
223
|
+
: unsupportedProviderOperation(base.provider, 'checks.resolveRun');
|
|
224
|
+
if (!resolved.ok)
|
|
225
|
+
return checksResult(providerStatus(resolved.error), {
|
|
226
|
+
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
227
|
+
resource: { kind: 'pull-request', number: base.prNumber }, pullRequest: base.pullRequest,
|
|
228
|
+
error: providerError(resolved.error, 'PLATFORM_PROVIDER_OPERATION_FAILED')
|
|
229
|
+
});
|
|
230
|
+
const runId = Number(resolved.value.runId);
|
|
231
|
+
if (!Number.isSafeInteger(runId) || runId <= 0)
|
|
232
|
+
return checksResult('failed', {
|
|
233
|
+
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
234
|
+
resource: { kind: 'pull-request', number: base.prNumber }, pullRequest: base.pullRequest,
|
|
235
|
+
error: { code: 'CHECK_RUN_IDENTITY_INVALID', message: 'Provider returned an invalid check run identity', retryable: false }
|
|
236
|
+
});
|
|
237
|
+
const jobId = resolved.value.jobId ? Number(resolved.value.jobId) : null;
|
|
238
|
+
return checksResult('no-op', {
|
|
239
|
+
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
240
|
+
resource: { kind: 'pull-request', number: base.prNumber }, pullRequest: base.pullRequest,
|
|
241
|
+
resolution: { status: 'resolved', runId, jobId: jobId !== null && Number.isSafeInteger(jobId) && jobId > 0 ? jobId : null }, error: null
|
|
242
|
+
});
|
|
226
243
|
}
|
|
227
|
-
const listed = base.client.json(['api', `repos/${base.context.platform.repository}/commits/${base.pullRequest.head.sha}/check-runs`], { cwd: base.resolved.repoRoot });
|
|
228
|
-
if (!listed.ok)
|
|
229
|
-
return checksResult(listed.error.retryable ? 'blocked' : 'failed', { error: listed.error });
|
|
230
|
-
const candidates = (listed.value.check_runs || []).flatMap((check) => {
|
|
231
|
-
if (check.name !== options.checkName || !check.details_url)
|
|
232
|
-
return [];
|
|
233
|
-
const identity = parseRunJobIdentity(check.details_url);
|
|
234
|
-
return identity ? [{ id: identity.runId, jobId: identity.jobId, name: check.name, headSha: base.pullRequest.head.sha }] : [];
|
|
235
|
-
});
|
|
236
|
-
const resolution = resolveRunCandidate(candidates, base.pullRequest.head.sha, options.checkName);
|
|
237
|
-
return checksResult(resolution.status === 'resolved' ? 'no-op' : 'failed', {
|
|
238
|
-
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
239
|
-
resource: { kind: 'pull-request', number: base.prNumber }, pullRequest: base.pullRequest,
|
|
240
|
-
resolution,
|
|
241
|
-
error: resolution.status === 'resolved' ? null : { code: resolution.status === 'ambiguous' ? 'CHECK_RUN_AMBIGUOUS' : 'CHECK_RUN_NOT_FOUND', message: `Check run is ${resolution.status}`, retryable: false }
|
|
242
|
-
});
|
|
243
244
|
}
|
|
244
245
|
function fetchCheckLogText(client, args, cwd) {
|
|
246
|
+
if (!client.text)
|
|
247
|
+
return { ok: false, error: { code: 'PLATFORM_CLIENT_TEXT_UNAVAILABLE', message: 'Platform client does not support text responses', retryable: false } };
|
|
245
248
|
const fetched = client.text(args, { cwd });
|
|
246
249
|
if (fetched.ok || args[0] !== 'api' || !/response contains terminal escape sequences/i.test(fetched.error.message)) {
|
|
247
250
|
return fetched;
|
|
248
251
|
}
|
|
249
252
|
return client.text([...args, '--allow-escape-sequences'], { cwd });
|
|
250
253
|
}
|
|
251
|
-
function fetchPlatformCheckLogs(taskRef, options) {
|
|
252
|
-
const base = resolvedTask(taskRef, options);
|
|
254
|
+
async function fetchPlatformCheckLogs(taskRef, options) {
|
|
255
|
+
const base = await resolvedTask(taskRef, options);
|
|
253
256
|
if (!base.ok)
|
|
254
257
|
return base.output;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
258
|
+
{
|
|
259
|
+
const fetched = base.provider.checks?.fetchLogs
|
|
260
|
+
? await base.provider.checks.fetchLogs({
|
|
261
|
+
context: providerOperationContext(base.loadedContext),
|
|
262
|
+
runId: String(options.run),
|
|
263
|
+
...(options.job ? { jobId: String(options.job) } : {})
|
|
264
|
+
})
|
|
265
|
+
: unsupportedProviderOperation(base.provider, 'checks.fetchLogs');
|
|
266
|
+
if (!fetched.ok)
|
|
267
|
+
return checksResult(providerStatus(fetched.error), {
|
|
268
|
+
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
269
|
+
resource: { kind: 'pull-request', number: base.prNumber }, pullRequest: base.pullRequest,
|
|
270
|
+
error: providerError(fetched.error, 'PLATFORM_PROVIDER_OPERATION_FAILED')
|
|
271
|
+
});
|
|
272
|
+
if (!fetched.value.text)
|
|
273
|
+
return checksResult('failed', {
|
|
274
|
+
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
275
|
+
error: { code: 'CHECK_LOGS_MISSING', message: 'No failed logs are available', retryable: false }
|
|
276
|
+
});
|
|
277
|
+
return checksResult('no-op', {
|
|
278
|
+
platform: base.context.platform, capabilities: base.context.capabilities,
|
|
279
|
+
resource: { kind: 'pull-request', number: base.prNumber }, pullRequest: base.pullRequest,
|
|
280
|
+
logs: { runId: options.run, ...(options.job ? { jobId: options.job } : {}), text: fetched.value.text }, error: null
|
|
281
|
+
});
|
|
282
|
+
}
|
|
268
283
|
}
|
|
269
|
-
export { classifyPullRequestReadiness, classifyRequiredChecks, fetchCheckLogText, fetchPlatformCheckLogs, inspectRequiredChecks, inspectPullRequestReadiness, parseRunJobIdentity, resolvePlatformCheckRun, resolveRunCandidate, watchPullRequestReadiness };
|
|
284
|
+
export { classifyPullRequestReadiness, classifyRequiredChecks, fetchCheckLogText, fetchPlatformCheckLogs, inspectGitHubRequiredChecks, inspectRequiredChecks, inspectPullRequestReadiness, parseRunJobIdentity, resolvePlatformCheckRun, resolveRunCandidate, watchPullRequestReadiness };
|
|
270
285
|
//# sourceMappingURL=pr-checks.js.map
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolvePlatformContext } from './context.js';
|
|
1
|
+
import { resolvePlatformProviderContext } from './context.js';
|
|
3
2
|
import { platformResult } from './types.js';
|
|
3
|
+
import { providerError, providerOperationContext, providerStatus, providerResourceToken, unsupportedProviderOperation } from './provider-bridge.js';
|
|
4
|
+
import { isResourceIdentity, resourceIdentityNumber, reviewMarker as resourceReviewMarker } from './resource-identity.js';
|
|
4
5
|
const REVIEW_EVENTS = ['COMMENT', 'APPROVE', 'REQUEST_CHANGES'];
|
|
5
6
|
// Marker-safe scope: a task id (`TASK-YYYYMMDD-HHMMSS`) or a bare PR number
|
|
6
7
|
// (`pr{N}`). Any other value (e.g. one containing `\r\n` or `-->`) would break
|
|
7
8
|
// the first-line marker idempotency contract of `reviewMarker` (PL-6).
|
|
8
9
|
const REVIEW_SCOPE_PATTERN = /^(?:pr\d+|TASK-\d{8}-\d{6})$/;
|
|
9
10
|
export function reviewMarker(identity) {
|
|
10
|
-
|
|
11
|
+
const scope = identity.resource && isResourceIdentity(identity.resource) && identity.resource.kind !== 'number'
|
|
12
|
+
? resourceReviewMarker(identity.resource)
|
|
13
|
+
: identity.scope;
|
|
14
|
+
return `<!-- review-pr:${scope}:r${identity.round} -->`;
|
|
11
15
|
}
|
|
12
16
|
export function reviewedCommitMarker(sha) {
|
|
13
17
|
return `<!-- reviewed-commit: ${sha} -->`;
|
|
@@ -21,81 +25,84 @@ function firstLine(body) {
|
|
|
21
25
|
function hasUsableContext(context) {
|
|
22
26
|
return (context.status === 'no-op' || context.status === 'degraded') && context.platform.repository !== null;
|
|
23
27
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export function listPrReviews(prNumber, options = {}) {
|
|
28
|
-
const client = options.client || createGitHubClient();
|
|
29
|
-
const context = resolvePlatformContext({ cwd: options.cwd || process.cwd(), client });
|
|
28
|
+
export async function listPrReviews(prNumber, options = {}) {
|
|
29
|
+
const loaded = await resolvePlatformProviderContext({ cwd: options.cwd || process.cwd(), client: options.client });
|
|
30
|
+
const context = loaded.ok ? loaded.value.context : loaded.context;
|
|
30
31
|
if (!hasUsableContext(context)) {
|
|
31
32
|
return { ...platformResult(context.status, { platform: context.platform, capabilities: context.capabilities, error: context.error }), reviews: [] };
|
|
32
33
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
34
|
+
const identity = loaded.ok ? (() => { try {
|
|
35
|
+
return providerResourceToken(loaded.value.provider, 'pull-request', String(prNumber));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
} })() : null;
|
|
40
|
+
if (!identity) {
|
|
35
41
|
return {
|
|
36
42
|
...platformResult('failed', {
|
|
37
43
|
platform: context.platform, capabilities: context.capabilities,
|
|
38
|
-
error: { code: '
|
|
44
|
+
error: { code: 'PLATFORM_IDENTITY_TOKEN_INVALID', message: 'Pull request token is invalid', retryable: false }
|
|
39
45
|
}),
|
|
40
46
|
reviews: []
|
|
41
47
|
};
|
|
42
48
|
}
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
49
|
+
const identityNumber = resourceIdentityNumber(identity);
|
|
50
|
+
if (loaded.ok) {
|
|
51
|
+
const fetched = loaded.value.provider.reviews?.list
|
|
52
|
+
? await loaded.value.provider.reviews.list({ context: providerOperationContext(loaded.value), changeRequest: identity })
|
|
53
|
+
: unsupportedProviderOperation(loaded.value.provider, 'reviews.list');
|
|
54
|
+
if (!fetched.ok)
|
|
55
|
+
return {
|
|
56
|
+
...platformResult(providerStatus(fetched.error), {
|
|
57
|
+
platform: context.platform, capabilities: context.capabilities,
|
|
58
|
+
resource: { kind: 'pull-request', number: identityNumber, identity }, error: providerError(fetched.error, 'PLATFORM_PROVIDER_OPERATION_FAILED')
|
|
59
|
+
}), reviews: []
|
|
60
|
+
};
|
|
45
61
|
return {
|
|
46
|
-
...platformResult(
|
|
62
|
+
...platformResult('no-op', {
|
|
47
63
|
platform: context.platform, capabilities: context.capabilities,
|
|
48
|
-
resource: { kind: 'pull-request', number:
|
|
64
|
+
resource: { kind: 'pull-request', number: identityNumber, identity }, error: null
|
|
49
65
|
}),
|
|
50
|
-
reviews:
|
|
66
|
+
reviews: fetched.value.map((review) => ({ id: review.id, commitId: review.commitSha || '', body: review.body, url: review.displayUrl || '' }))
|
|
51
67
|
};
|
|
52
68
|
}
|
|
53
|
-
|
|
54
|
-
const reviews = flat
|
|
55
|
-
.map((review) => ({
|
|
56
|
-
id: review.id ?? 0,
|
|
57
|
-
commitId: review.commit_id ?? '',
|
|
58
|
-
body: review.body ?? '',
|
|
59
|
-
url: review.html_url ?? ''
|
|
60
|
-
}))
|
|
61
|
-
.filter((review) => review.body !== '');
|
|
62
|
-
return {
|
|
63
|
-
...platformResult('no-op', {
|
|
64
|
-
platform: context.platform, capabilities: context.capabilities,
|
|
65
|
-
resource: { kind: 'pull-request', number: prNumber }, error: null
|
|
66
|
-
}),
|
|
67
|
-
reviews
|
|
68
|
-
};
|
|
69
|
+
return { ...platformResult('failed', { platform: context.platform, capabilities: context.capabilities, error: context.error }), reviews: [] };
|
|
69
70
|
}
|
|
70
|
-
export function publishPrReview(options) {
|
|
71
|
-
const
|
|
72
|
-
const context =
|
|
71
|
+
export async function publishPrReview(options) {
|
|
72
|
+
const loaded = await resolvePlatformProviderContext({ cwd: options.cwd || process.cwd(), client: options.client });
|
|
73
|
+
const context = loaded.ok ? loaded.value.context : loaded.context;
|
|
73
74
|
if (!hasUsableContext(context)) {
|
|
74
75
|
return platformResult(context.status, { platform: context.platform, capabilities: context.capabilities, error: context.error });
|
|
75
76
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
77
|
+
const identity = loaded.ok ? (() => { try {
|
|
78
|
+
return providerResourceToken(loaded.value.provider, 'pull-request', String(options.prNumber));
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
} })() : null;
|
|
83
|
+
if (!identity) {
|
|
78
84
|
return platformResult('failed', {
|
|
79
85
|
platform: context.platform, capabilities: context.capabilities,
|
|
80
|
-
error: { code: '
|
|
86
|
+
error: { code: 'PLATFORM_IDENTITY_TOKEN_INVALID', message: 'Pull request token is invalid', retryable: false }
|
|
81
87
|
});
|
|
82
88
|
}
|
|
89
|
+
const identityNumber = resourceIdentityNumber(identity);
|
|
83
90
|
if (!REVIEW_EVENTS.includes(options.event)) {
|
|
84
91
|
return platformResult('failed', {
|
|
85
92
|
platform: context.platform, capabilities: context.capabilities,
|
|
86
|
-
resource: { kind: 'pull-request', number:
|
|
93
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
87
94
|
error: { code: 'REVIEW_EVENT_INVALID', message: `review event must be one of ${REVIEW_EVENTS.join('|')}`, retryable: false }
|
|
88
95
|
});
|
|
89
96
|
}
|
|
90
97
|
if (!REVIEW_SCOPE_PATTERN.test(options.identity.scope) || !/^[0-9a-f]{7,40}$/i.test(options.identity.commitSha)) {
|
|
91
98
|
return platformResult('failed', {
|
|
92
99
|
platform: context.platform, capabilities: context.capabilities,
|
|
93
|
-
resource: { kind: 'pull-request', number:
|
|
100
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
94
101
|
error: { code: 'REVIEW_IDENTITY_INVALID', message: 'review scope must be a task id or pr{N}; commitSha is required', retryable: false }
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
|
-
const marker = reviewMarker(options.identity);
|
|
98
|
-
const listed = listPrReviews(options.prNumber, { cwd: options.cwd, client });
|
|
104
|
+
const marker = reviewMarker({ ...options.identity, resource: identity });
|
|
105
|
+
const listed = await listPrReviews(options.prNumber, { cwd: options.cwd, client: options.client });
|
|
99
106
|
if (listed.status === 'failed' || listed.status === 'blocked')
|
|
100
107
|
return listed;
|
|
101
108
|
const existing = listed.reviews.find((review) => firstLine(review.body) === marker) ?? null;
|
|
@@ -103,13 +110,13 @@ export function publishPrReview(options) {
|
|
|
103
110
|
if (existing.commitId === options.identity.commitSha) {
|
|
104
111
|
return platformResult('no-op', {
|
|
105
112
|
platform: context.platform, capabilities: context.capabilities,
|
|
106
|
-
resource: { kind: 'pull-request', number:
|
|
113
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
107
114
|
operations: [{ name: 'review:publish', status: 'no-op', reasonCode: null }], error: null
|
|
108
115
|
});
|
|
109
116
|
}
|
|
110
117
|
return platformResult('failed', {
|
|
111
118
|
platform: context.platform, capabilities: context.capabilities,
|
|
112
|
-
resource: { kind: 'pull-request', number:
|
|
119
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
113
120
|
operations: [{ name: 'review:publish', status: 'failed', reasonCode: 'REVIEW_MARKER_CONFLICT' }],
|
|
114
121
|
error: { code: 'REVIEW_MARKER_CONFLICT', message: 'A review with the same marker targets a different commit; start a new round', retryable: false }
|
|
115
122
|
});
|
|
@@ -124,43 +131,52 @@ export function publishPrReview(options) {
|
|
|
124
131
|
if (options.dryRun) {
|
|
125
132
|
return platformResult('planned', {
|
|
126
133
|
platform: context.platform, capabilities: context.capabilities,
|
|
127
|
-
resource: { kind: 'pull-request', number:
|
|
134
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
128
135
|
operations: [{ name: 'review:publish', status: 'planned', reasonCode: null }], error: null
|
|
129
136
|
});
|
|
130
137
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
if (loaded.ok) {
|
|
139
|
+
const published = loaded.value.provider.reviews?.publish
|
|
140
|
+
? await loaded.value.provider.reviews.publish({
|
|
141
|
+
context: providerOperationContext(loaded.value),
|
|
142
|
+
changeRequest: identity,
|
|
143
|
+
identity: options.identity,
|
|
144
|
+
event: options.event,
|
|
145
|
+
body: wrappedBody,
|
|
146
|
+
mutation: { idempotencyKey: `review:publish:${marker}` }
|
|
147
|
+
})
|
|
148
|
+
: unsupportedProviderOperation(loaded.value.provider, 'reviews.publish');
|
|
149
|
+
if (!published.ok) {
|
|
150
|
+
if (published.error.retryable) {
|
|
151
|
+
const reconciled = await listPrReviews(options.prNumber, { cwd: options.cwd, client: options.client });
|
|
152
|
+
const found = reconciled.reviews.find((review) => firstLine(review.body) === marker);
|
|
153
|
+
if (found)
|
|
154
|
+
return platformResult('applied', {
|
|
155
|
+
changed: true, platform: context.platform, capabilities: context.capabilities,
|
|
156
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
157
|
+
operations: [{ name: 'review:publish', status: 'applied', reasonCode: 'CREATE_RECONCILED' }], error: null
|
|
158
|
+
});
|
|
159
|
+
return platformResult('blocked', {
|
|
160
|
+
platform: context.platform, capabilities: context.capabilities,
|
|
161
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
162
|
+
operations: [{ name: 'review:publish', status: 'failed', reasonCode: 'REVIEW_CREATE_OUTCOME_UNKNOWN' }],
|
|
163
|
+
error: { code: 'REVIEW_CREATE_OUTCOME_UNKNOWN', message: published.error.message, retryable: true }
|
|
145
164
|
});
|
|
146
165
|
}
|
|
147
|
-
return platformResult(
|
|
166
|
+
return platformResult(providerStatus(published.error), {
|
|
148
167
|
platform: context.platform, capabilities: context.capabilities,
|
|
149
|
-
resource: { kind: 'pull-request', number:
|
|
150
|
-
operations: [{ name: 'review:publish', status: 'failed', reasonCode:
|
|
151
|
-
error:
|
|
168
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
169
|
+
operations: [{ name: 'review:publish', status: 'failed', reasonCode: published.error.code }],
|
|
170
|
+
error: providerError(published.error, 'PLATFORM_PROVIDER_OPERATION_FAILED')
|
|
152
171
|
});
|
|
153
172
|
}
|
|
154
|
-
return platformResult('
|
|
173
|
+
return platformResult('applied', {
|
|
174
|
+
changed: published.value.changed,
|
|
155
175
|
platform: context.platform, capabilities: context.capabilities,
|
|
156
|
-
resource: { kind: 'pull-request', number:
|
|
157
|
-
operations: [{ name: 'review:publish', status: '
|
|
176
|
+
resource: { kind: 'pull-request', number: identityNumber, identity },
|
|
177
|
+
operations: [{ name: 'review:publish', status: 'applied', reasonCode: null }], error: null
|
|
158
178
|
});
|
|
159
179
|
}
|
|
160
|
-
return platformResult('
|
|
161
|
-
changed: true, platform: context.platform, capabilities: context.capabilities,
|
|
162
|
-
resource: { kind: 'pull-request', number: options.prNumber },
|
|
163
|
-
operations: [{ name: 'review:publish', status: 'applied', reasonCode: null }], error: null
|
|
164
|
-
});
|
|
180
|
+
return platformResult('failed', { platform: context.platform, capabilities: context.capabilities, error: context.error });
|
|
165
181
|
}
|
|
166
182
|
//# sourceMappingURL=pr-review.js.map
|