@hellopearl/dv-gitlab 0.4.0 → 0.4.2
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/bin/dv-gitlab.mjs +8 -0
- package/ci/e2e-enforce.yml +5 -0
- package/package.json +5 -2
- package/src/commands/postbuild.mjs +13 -12
package/bin/dv-gitlab.mjs
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
if (typeof globalThis.fetch === 'undefined') {
|
|
5
|
+
const mod = await import('node-fetch');
|
|
6
|
+
globalThis.fetch = mod.default;
|
|
7
|
+
globalThis.Headers = mod.Headers;
|
|
8
|
+
globalThis.Request = mod.Request;
|
|
9
|
+
globalThis.Response = mod.Response;
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
import { run } from '../src/cli.mjs';
|
|
5
13
|
|
|
6
14
|
run(process.argv.slice(2));
|
package/ci/e2e-enforce.yml
CHANGED
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
exit 1
|
|
37
37
|
fi
|
|
38
38
|
|
|
39
|
+
if [ -z "$GITLAB_API_TOKEN" ]; then
|
|
40
|
+
echo "[e2e-enforce] GITLAB_API_TOKEN not set — skipping E2E (configure in CI/CD variables)"
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
|
|
39
44
|
BRANCH_SLUG=$(echo "$CI_COMMIT_REF_NAME" | tr '[:upper:]' '[:lower:]' | sed 's|/|-|g')
|
|
40
45
|
PREVIEW_URL="https://${BRANCH_SLUG}.${PREVIEW_DOMAIN}"
|
|
41
46
|
echo "[e2e-enforce] Preview URL: $PREVIEW_URL"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hellopearl/dv-gitlab",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Unified GitLab CI tooling -- MR comments, pipeline triggers, preview env management",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -39,11 +39,14 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"registry": "https://registry.npmjs.org/"
|
|
41
41
|
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"node-fetch": "^3.3.2"
|
|
44
|
+
},
|
|
42
45
|
"devDependencies": {
|
|
43
46
|
"@hellopearl/dv-deps": "*",
|
|
44
47
|
"@hellopearl/dv-lint": "*",
|
|
45
48
|
"@hellopearl/dv-prettier": "*",
|
|
46
49
|
"@hellopearl/dv-test": "*"
|
|
47
50
|
},
|
|
48
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "36acb7c5235796449a1425d8a8853f424c1bbb2a"
|
|
49
52
|
}
|
|
@@ -226,13 +226,20 @@ export async function postbuild() {
|
|
|
226
226
|
region,
|
|
227
227
|
});
|
|
228
228
|
|
|
229
|
-
const
|
|
230
|
-
projectId,
|
|
231
|
-
mr.iid,
|
|
229
|
+
const markers = [
|
|
232
230
|
'<!-- amplify:build-status -->',
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
231
|
+
'<!-- amplify:pipeline-trigger -->',
|
|
232
|
+
'<!-- qa:automation-results -->',
|
|
233
|
+
];
|
|
234
|
+
for (const marker of markers) {
|
|
235
|
+
const deleted = await client.deleteNotesByMarker(
|
|
236
|
+
projectId,
|
|
237
|
+
mr.iid,
|
|
238
|
+
marker,
|
|
239
|
+
);
|
|
240
|
+
if (deleted) {
|
|
241
|
+
debug(`[postbuild] removed ${deleted} stale comment(s) [${marker}]`);
|
|
242
|
+
}
|
|
236
243
|
}
|
|
237
244
|
|
|
238
245
|
const posted = await client.postNote(projectId, mr.iid, commentBody);
|
|
@@ -248,12 +255,6 @@ export async function postbuild() {
|
|
|
248
255
|
return;
|
|
249
256
|
}
|
|
250
257
|
|
|
251
|
-
await client.deleteNotesByMarker(
|
|
252
|
-
projectId,
|
|
253
|
-
mr.iid,
|
|
254
|
-
'<!-- amplify:pipeline-trigger -->',
|
|
255
|
-
);
|
|
256
|
-
|
|
257
258
|
const triggerResult = await triggerPipelinePreview({
|
|
258
259
|
appId,
|
|
259
260
|
branch,
|