grafana/.github/workflows/scripts/json-file-to-job-output.js
Levente Balogh 8ed5b95f42
Chore: change triggering of the detect-breaking-changes Github flow (#43188)
* chore: only run the breaking-changes flow on pull requests

* chore: run the detect-breaking-changes flow on opening a PR

* chore: use

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* Wip

* trying to get workflow split running.

* trying to trigger workflow.

* trying to trigger.

* Splits levitate job into two workflows.

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2022-01-03 12:48:12 +01:00

27 lines
738 B
JavaScript

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);
});
});
}