From fc5ad8ca4523d2d13aa2f6e05d7ad8f2e386715c Mon Sep 17 00:00:00 2001 From: fraxy-v <65565042+fraxy-v@users.noreply.github.com> Date: Sat, 31 Aug 2024 14:37:25 +0300 Subject: [PATCH] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index b85b942..8180c78 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -90,17 +90,24 @@ jobs: with: xml-out: coverage.xml - - run: npm install xml2json + - run: npm install xml2js - name: Check coverage report id: check-coverage uses: actions/github-script@v7 with: script: | - fs = require('fs'); - let parser = require('xml2json'); + var fs = require('fs'); + var parseString = require('xml2js').parseString; - fs.readFile( 'coverage.xml', function(err, data) { - var json = parser.toJson(data); - console.log("to json ->", json); - }); + function requestReport(callback) { + fs.readFile('./response.xml', 'utf8', function(err, data) { + if (err) return callback(err); + parseString(data, callback); + }); + } + + requestReport(function(err, result) { + if (err) return console.error(err); + console.log(result); + });