The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/.github/workflows/scripts/json-file-to-job-output.js

27 lines
738 B

module.exports = async ({ core, filePath }) => {
try {
const fs = require('fs');
const content = await readFile(fs, filePath);
const result = JSON.parse(content);
core.startGroup('Parsing json file...');
for (const property in result) {
core.info(`${property} <- ${result[property]}`);
core.setOutput(property, result[property]);
}
core.endGroup();
} catch (error) {
core.restFailed(error.message);
}
}
async function readFile(fs, path) {
return new Promise((resolve, reject) => {
fs.readFile(path, (error, data) => {
if (error) return reject(error);
return resolve(data);
});
});
}