gowalk-cicd 1.0.122 → 1.0.123
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/action/.daemux-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.123
|
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.123
|
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.123
|
package/package.json
CHANGED
package/src/install.mjs
CHANGED
|
@@ -127,6 +127,70 @@ function copyAction(source, destination, repoRoot, dryRun) {
|
|
|
127
127
|
return { dest, existed, fileCount };
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
// A workflow overwrite is wholesale: the template replaces the consumer's file.
|
|
131
|
+
// Anything that repo had tuned for itself is gone, and until now silently — the
|
|
132
|
+
// only thing standing between an app and a broken deploy was somebody reading
|
|
133
|
+
// the diff. obd-scanner adopted twice in one morning and both times the
|
|
134
|
+
// template's `runtime-env: ${{ secrets.BACKEND_RUNTIME_ENV }}` replaced an
|
|
135
|
+
// inline runtime env for a secret that repo does not define; adopting it as
|
|
136
|
+
// written would have deployed an empty environment (2026-09-09).
|
|
137
|
+
//
|
|
138
|
+
// So say what changed. This is a receipt, not a merge: the template still wins,
|
|
139
|
+
// and the adopting session is told exactly which of its own bindings to put
|
|
140
|
+
// back. Workflows are committed files, so nothing here is secret material —
|
|
141
|
+
// values are truncated only to keep the report readable.
|
|
142
|
+
const BINDING = /^\s*([A-Za-z0-9_.-]+):\s*(\S.*?)\s*$/;
|
|
143
|
+
const REPORT_LIMIT = 20;
|
|
144
|
+
|
|
145
|
+
function bindings(text) {
|
|
146
|
+
// Every distinct `key: value` pair, not one per key. Keys like
|
|
147
|
+
// `timeout-minutes` appear many times across jobs and an app tunes a
|
|
148
|
+
// particular one; keying by name alone reported the first occurrence and
|
|
149
|
+
// silently missed exactly the binding that had been changed.
|
|
150
|
+
const found = new Map();
|
|
151
|
+
for (const line of String(text).split('\n')) {
|
|
152
|
+
const match = BINDING.exec(line);
|
|
153
|
+
if (!match) continue;
|
|
154
|
+
const [, key, value] = match;
|
|
155
|
+
if (!found.has(key)) found.set(key, new Set());
|
|
156
|
+
found.get(key).add(value);
|
|
157
|
+
}
|
|
158
|
+
return found;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function short(value) {
|
|
162
|
+
const text = String(value).replace(/\s+/g, ' ').trim();
|
|
163
|
+
return text.length > 80 ? text.slice(0, 77) + '...' : text;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function changedBindings(before, after) {
|
|
167
|
+
const old = bindings(before), fresh = bindings(after);
|
|
168
|
+
const changes = [];
|
|
169
|
+
for (const [key, values] of old) {
|
|
170
|
+
const now = fresh.get(key);
|
|
171
|
+
for (const value of values) {
|
|
172
|
+
if (now && now.has(value)) continue; // this exact pair survived
|
|
173
|
+
changes.push({ key, before: value, after: now ? [...now].join(' | ') : null });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return changes;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function reportOverwrite(relative, before, after) {
|
|
180
|
+
const changes = changedBindings(before, after);
|
|
181
|
+
if (!changes.length) return changes;
|
|
182
|
+
console.log(` ${relative}: ${changes.length} binding(s) this repo had set were replaced by the template.`);
|
|
183
|
+
console.log(' Restore the ones this app owns before committing:');
|
|
184
|
+
for (const change of changes.slice(0, REPORT_LIMIT)) {
|
|
185
|
+
console.log(` ${change.key}: ${short(change.before)}`
|
|
186
|
+
+ (change.after === null ? ' -> (removed)' : ` -> ${short(change.after)}`));
|
|
187
|
+
}
|
|
188
|
+
if (changes.length > REPORT_LIMIT) {
|
|
189
|
+
console.log(` ...and ${changes.length - REPORT_LIMIT} more; read the full diff.`);
|
|
190
|
+
}
|
|
191
|
+
return changes;
|
|
192
|
+
}
|
|
193
|
+
|
|
130
194
|
function copyWorkflow(repoRoot, dryRun) {
|
|
131
195
|
const dest = join(repoRoot, WORKFLOW_DEST_REL);
|
|
132
196
|
const existed = existsSync(dest);
|
|
@@ -135,8 +199,10 @@ function copyWorkflow(repoRoot, dryRun) {
|
|
|
135
199
|
return { dest, existed };
|
|
136
200
|
}
|
|
137
201
|
ensureDir(dirname(dest));
|
|
202
|
+
const previous = existed ? readFileSync(dest, 'utf8') : '';
|
|
138
203
|
cpSync(WORKFLOW_TEMPLATE, dest, { force: true });
|
|
139
204
|
console.log(` ${existed ? 'Overwrote' : 'Created'} ${WORKFLOW_DEST_REL}`);
|
|
205
|
+
if (existed) reportOverwrite(WORKFLOW_DEST_REL, previous, readFileSync(dest, 'utf8'));
|
|
140
206
|
return { dest, existed };
|
|
141
207
|
}
|
|
142
208
|
|
|
@@ -148,8 +214,10 @@ function copyBackendWorkflow(repoRoot, dryRun) {
|
|
|
148
214
|
return;
|
|
149
215
|
}
|
|
150
216
|
ensureDir(dirname(dest));
|
|
217
|
+
const previous = existed ? readFileSync(dest, 'utf8') : '';
|
|
151
218
|
cpSync(BACKEND_WORKFLOW_TEMPLATE, dest, { force: true });
|
|
152
219
|
console.log(` ${existed ? 'Overwrote' : 'Created'} ${BACKEND_WORKFLOW_DEST_REL}`);
|
|
220
|
+
if (existed) reportOverwrite(BACKEND_WORKFLOW_DEST_REL, previous, readFileSync(dest, 'utf8'));
|
|
153
221
|
}
|
|
154
222
|
|
|
155
223
|
function writeVersionMarkers(repoRoot, dryRun) {
|
|
@@ -244,8 +312,12 @@ export async function runInstall({ dryRun = false } = {}) {
|
|
|
244
312
|
console.log(` [dry-run] ${webWorkflowExisted ? 'overwrite' : 'create'} ${WEB_WORKFLOW_DEST_REL}`);
|
|
245
313
|
} else {
|
|
246
314
|
ensureDir(dirname(webWorkflowDest));
|
|
315
|
+
const webWorkflowPrevious = webWorkflowExisted ? readFileSync(webWorkflowDest, 'utf8') : '';
|
|
247
316
|
cpSync(WEB_WORKFLOW_TEMPLATE, webWorkflowDest, { force: true });
|
|
248
317
|
console.log(` ${webWorkflowExisted ? 'Overwrote' : 'Created'} ${WEB_WORKFLOW_DEST_REL}`);
|
|
318
|
+
if (webWorkflowExisted) {
|
|
319
|
+
reportOverwrite(WEB_WORKFLOW_DEST_REL, webWorkflowPrevious, readFileSync(webWorkflowDest, 'utf8'));
|
|
320
|
+
}
|
|
249
321
|
}
|
|
250
322
|
}
|
|
251
323
|
|