@cmflow/cli 3.1.3 → 3.1.5
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/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -310,7 +310,7 @@ The `jira-releases` command lists and (optionally) updates Jira versions related
|
|
|
310
310
|
- `DIRECTUS_FLOW_ID`
|
|
311
311
|
- `DIRECTUS_ACCESS_TOKEN`
|
|
312
312
|
|
|
313
|
-
If all
|
|
313
|
+
If all three Directus variables are present, `CmFlow` considers `CAN_TRIGGER_WORKFLOW=true` and will attempt to run the workflow after updating releases.
|
|
314
314
|
|
|
315
315
|
### Usage
|
|
316
316
|
|
package/package.json
CHANGED
|
@@ -14,23 +14,26 @@ export async function getJiraReleases(projectId) {
|
|
|
14
14
|
|
|
15
15
|
export async function updateJiraRelease(release) {
|
|
16
16
|
const endpoint = `/rest/api/3/version/${release.id}`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
try {
|
|
18
|
+
await jiraRequest(endpoint, {
|
|
19
|
+
method: "put",
|
|
20
|
+
headers: {
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
Accept: "application/json"
|
|
23
|
+
},
|
|
24
|
+
body: {
|
|
25
|
+
id: release.id,
|
|
26
|
+
description: release.description,
|
|
27
|
+
name: release.name,
|
|
28
|
+
archived: release.archived,
|
|
29
|
+
released: release.released,
|
|
30
|
+
projectId: release.projectId,
|
|
31
|
+
releaseDate: release.releaseDate
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
} catch (er) {
|
|
35
|
+
console.log(`Error while updating jira release ${release.id}`, er);
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
export async function getJiraVersionRelatedIssues(projectId, tagVersion) {
|
|
@@ -9,7 +9,8 @@ export async function jiraRequest(endpoint, opts = {}) {
|
|
|
9
9
|
const auth = Buffer.from(`${JIRA_EMAIL}:${JIRA_TOKEN}`).toString("base64");
|
|
10
10
|
|
|
11
11
|
if (opts.body && opts.headers?.["Content-Type"] === "application/json") {
|
|
12
|
-
opts.
|
|
12
|
+
opts.data = JSON.stringify(opts.body);
|
|
13
|
+
delete opts.body;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
return httpRequest(jiraUrl, {
|
|
@@ -32,22 +32,22 @@ describe("jiraRequest", () => {
|
|
|
32
32
|
|
|
33
33
|
const result = await jiraRequest("/test-endpoint", {
|
|
34
34
|
method: "post",
|
|
35
|
-
params: { key: "value" }
|
|
35
|
+
params: { key: "value" },
|
|
36
|
+
headers: { "Content-Type": "application/json" },
|
|
37
|
+
body: { key: "value" }
|
|
36
38
|
});
|
|
37
39
|
|
|
38
|
-
expect(httpRequest).toHaveBeenCalledWith(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
);
|
|
40
|
+
expect(httpRequest).toHaveBeenCalledWith(expect.stringContaining("/test-endpoint"), {
|
|
41
|
+
callee: "JIRA",
|
|
42
|
+
method: "post",
|
|
43
|
+
params: { key: "value" },
|
|
44
|
+
data: JSON.stringify({ key: "value" }),
|
|
45
|
+
headers: expect.objectContaining({
|
|
46
|
+
Authorization: expect.stringContaining("Basic ")
|
|
47
|
+
}),
|
|
48
|
+
retries: 3,
|
|
49
|
+
retryDelay: expect.any(Function)
|
|
50
|
+
});
|
|
51
51
|
expect(result).toEqual(mockResponse);
|
|
52
52
|
});
|
|
53
53
|
|