@futurelastic/colab-handbook 1.13.0-rc.41 → 1.13.0-rc.42

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/package.json CHANGED
@@ -33,5 +33,5 @@
33
33
  "engines": {
34
34
  "node": ">=18"
35
35
  },
36
- "version": "1.13.0-rc.41"
36
+ "version": "1.13.0-rc.42"
37
37
  }
@@ -14,7 +14,8 @@
14
14
  // previous final), verifies that, and still fails the run. A manual rollback is a re-run
15
15
  // with the previous tag.
16
16
  // The outcome — "running vX.Y.Z at <time>" or the failure — goes to the run summary and, when one
17
- // exists, to the release issue (the issue carrying `<!-- colab:release version=vX.Y.Z -->`).
17
+ // exists, to the release issue (the issue whose body STARTS with `<!-- colab:release version=vX.Y.Z -->`;
18
+ // one that only mentions it is not the record — #576).
18
19
  //
19
20
  // CONFIGURATION (env; the workflow's one env block):
20
21
  // DEPLOY_ADAPTER portainer (default) — loads ./deploy-adapter-<name>.mjs beside this file
@@ -187,12 +188,25 @@ async function waitForVersion(url, version, io, timeoutS, auth = {}) {
187
188
  }
188
189
  }
189
190
 
191
+ // The release issue is the one whose body STARTS with the marker (leading whitespace tolerated) —
192
+ // never one that merely mentions it, which the search above also returns, in an order GitHub's
193
+ // ranking decides (#576). The same anchored rule as the handbook's release codec
194
+ // (`decodeTrackingMarker`, #575), restated here because this copy never calls back to the handbook.
195
+ export function releaseIssue(json, tag) {
196
+ let list;
197
+ try { list = JSON.parse(json || '[]'); } catch { return ''; }
198
+ if (!Array.isArray(list)) return '';
199
+ const re = /^\s*<!--\s*colab:release\s+version=(v[0-9]+\.[0-9]+\.[0-9]+)\s*-->/;
200
+ const hit = list.find((i) => { const m = re.exec(String((i && i.body) || '')); return m && m[1] === tag; });
201
+ return hit ? String(hit.number) : '';
202
+ }
203
+
190
204
  function record(io, tag, line) {
191
205
  io.summary(line);
192
206
  const repo = io.env.GITHUB_REPOSITORY;
193
207
  if (!repo) return;
194
- const found = io.sh('gh', ['issue', 'list', '--repo', repo, '--state', 'all', '--search', `"colab:release version=${tag}" in:body`, '--json', 'number', '--jq', '.[0].number // ""']);
195
- const n = found.status === 0 ? found.stdout.trim() : '';
208
+ const found = io.sh('gh', ['issue', 'list', '--repo', repo, '--state', 'all', '--search', `"colab:release version=${tag}" in:body`, '--json', 'number,body']);
209
+ const n = found.status === 0 ? releaseIssue(found.stdout, tag) : '';
196
210
  if (!n) { io.log(`no release issue for ${tag} — recorded in the run summary only`); return; }
197
211
  const c = io.sh('gh', ['issue', 'comment', n, '--repo', repo, '--body', line]);
198
212
  if (c.status !== 0) io.log(`could not comment on release issue #${n}: ${c.stderr.trim()}`);