@remogram/provider-gitlab-api 0.1.0-beta.5 → 0.1.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +13 -22
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  gitAheadBehind,
11
11
  refsInventory,
12
12
  crInventory,
13
- buildMergePlanBodyFromFacts,
13
+ buildMergePlanFromProviderFacts,
14
14
  ERROR_CODES,
15
15
  forgeError,
16
16
  forgeIngestCapabilityFacts,
@@ -51,6 +51,7 @@ import {
51
51
  normalizeStatusSetState,
52
52
  MAX_OPEN_PULL_IDEMPOTENCY_PAGES,
53
53
  statusSetIdempotencyScanCapabilityFacts,
54
+ assertWriteCommandConfigured,
54
55
  } from '@remogram/core';
55
56
 
56
57
  const PUBLIC_GITLAB_HOST = 'gitlab.com';
@@ -245,10 +246,10 @@ export async function refsCompare(ctx, baseRef, headRef) {
245
246
  });
246
247
  }
247
248
  return {
248
- base_ref: sanitizeField(baseRef),
249
- base_sha: baseSha,
250
- head_ref: sanitizeField(headRef),
251
- head_sha: headSha,
249
+ compare_base_ref: sanitizeField(baseRef),
250
+ compare_base_sha: baseSha,
251
+ compare_head_ref: sanitizeField(headRef),
252
+ compare_head_sha: headSha,
252
253
  ...gitAheadBehind(ctx.cwd, baseSha, headSha),
253
254
  };
254
255
  }
@@ -285,10 +286,10 @@ export async function prView(ctx, opts) {
285
286
  url: sanitizeUrl(mr.web_url ?? mr.url),
286
287
  title: sanitizeField(mr.title),
287
288
  state: normalizeMrState(mr.state),
288
- base_ref: sanitizeField(mr.target_branch),
289
- base_sha: sanitizeField(mr.diff_refs?.base_sha),
290
- head_ref: sanitizeField(mr.source_branch),
291
- head_sha: sanitizeField(mr.sha ?? mr.diff_refs?.head_sha),
289
+ forge_target_branch_ref: sanitizeField(mr.target_branch),
290
+ forge_target_sha: sanitizeField(mr.diff_refs?.base_sha),
291
+ forge_source_branch_ref: sanitizeField(mr.source_branch),
292
+ forge_source_sha: sanitizeField(mr.sha ?? mr.diff_refs?.head_sha),
292
293
  mergeability: mergeability(mr),
293
294
  };
294
295
  }
@@ -357,7 +358,7 @@ export async function prChecks(ctx, opts) {
357
358
  const mapped = [...mappedStatuses, ...mappedPipelines];
358
359
  const checks_truncated = statusResult.truncated || pipelineResult.truncated;
359
360
  return {
360
- head_sha: sha,
361
+ forge_source_sha: sha,
361
362
  check_conclusion: summarizeChecks(mapped),
362
363
  checks_truncated,
363
364
  statuses: mapped,
@@ -365,18 +366,7 @@ export async function prChecks(ctx, opts) {
365
366
  }
366
367
 
367
368
  export async function mergePlan(ctx, opts) {
368
- const view = await prView(ctx, opts);
369
- const checks = await prChecks(ctx, { number: view.pr_number });
370
- let mergeOpts = opts;
371
- if (opts.allowed_paths) {
372
- try {
373
- const crFilesBody = await crFiles(ctx, { number: view.pr_number });
374
- mergeOpts = { ...opts, changed_paths: crFilesBody.changed_paths };
375
- } catch {
376
- // Fall back to local git diff in resolveMergePlanPathScope.
377
- }
378
- }
379
- return buildMergePlanBodyFromFacts(ctx, view, checks, mergeOpts);
369
+ return buildMergePlanFromProviderFacts(ctx, opts, { prView, prChecks, crFiles });
380
370
  }
381
371
 
382
372
  export async function crFiles(ctx, { number }) {
@@ -866,6 +856,7 @@ export async function findCommitStatusByContext(ctx, sha, context) {
866
856
  }
867
857
 
868
858
  export async function statusSet(ctx, args) {
859
+ assertWriteCommandConfigured(ctx.config, 'status_set');
869
860
  const parsed = parseStatusSetArgs(args);
870
861
  const existing = await findCommitStatusByContext(ctx, parsed.sha, parsed.context);
871
862
  if (existing) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remogram/provider-gitlab-api",
3
- "version": "0.1.0-beta.5",
3
+ "version": "0.1.0-beta.8",
4
4
  "description": "GitLab API provider for remogram",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "node": ">=20"
23
23
  },
24
24
  "dependencies": {
25
- "@remogram/core": "0.1.0-beta.5"
25
+ "@remogram/core": "0.1.0-beta.8"
26
26
  }
27
27
  }