-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (39 loc) · 1.53 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const core = require('@actions/core');
const axios = require('axios').default;
try {
const baseURL = core.getInput('baseURL');
const componentId = core.getInput('componentId');
const versionId = core.getInput('versionId');
const sourceCommit = core.getInput('sourceCommit');
const gitOpsCommit = core.getInput('gitOpsCommit');
const status = core.getInput('status');
const workflow = core.getInput('workflow');
const configMappingId = core.getInput('configMappingId');
const url = `${baseURL}/orgs/choreo/projects/project/components/${componentId}/versions/${versionId}/commits/${sourceCommit}/configurable-commit-mapping`;
const payload = {
status: status,
workflow: workflow,
id: configMappingId,
gitOpsCommit: gitOpsCommit
}
console.log("Payload : ", payload);
axios.put(url, payload).then(
() => {
console.log("choreo-update-config-generation-status", "saved");
}
).catch((error => {
console.error('Error', error);
if (error.response) {
console.log("choreo-status", error.response.data);
console.log(error.response.status);
} else if (error.request) {
console.log(error.request);
} else {
console.log('Error', error.message);
console.log("choreo-status", "failed");
}
}))
} catch (e) {
console.log("choreo-update-config-generation-status-save", "failed");
console.log("choreo-update-config-generation-status-save", e.message);
}