mirror of
https://github.com/codecov/codecov-action.git
synced 2026-04-12 17:10:05 +00:00
fix: use vanilla node to download uncorrupted
This commit is contained in:
parent
f4d4c99f20
commit
6f5f475233
5 changed files with 154 additions and 32780 deletions
36
src/index.ts
36
src/index.ts
|
|
@ -3,34 +3,32 @@ const fs = require('fs');
|
|||
const core = require('@actions/core');
|
||||
const exec = require('@actions/exec');
|
||||
// const childProcess = require('child_process');
|
||||
|
||||
const request = require('request');
|
||||
const https = require('https');
|
||||
|
||||
// import buildExec from './buildExec';
|
||||
|
||||
// const {failCi} = buildExec();
|
||||
|
||||
try {
|
||||
const url = 'https://uploader.codecov.io/latest/codecov-linux';
|
||||
const filename = __dirname + '/uploader';
|
||||
request.get('https://uploader.codecov.io/latest/codecov-linux', (err, res, body) => {
|
||||
if (err) {
|
||||
core.setFailed(
|
||||
'Codecov: Could not properly download uploader binary: ' +
|
||||
`${err.message}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFileSync(filename, body);
|
||||
// TODO - validate step
|
||||
fs.chmodSync(filename, '777');
|
||||
https.get(url, (res) => {
|
||||
// Image will be stored at this path
|
||||
const filePath = fs.createWriteStream(filename);
|
||||
res.pipe(filePath);
|
||||
filePath.on('finish', () => {
|
||||
filePath.close();
|
||||
// TODO - validate step
|
||||
fs.chmodSync(filename, '777');
|
||||
|
||||
exec.exec(filename).catch((err) => {
|
||||
core.setFailed(
|
||||
'Codecov: Failed to properly upload: ' +
|
||||
`${err.message}`,
|
||||
);
|
||||
return;
|
||||
exec.exec(filename).catch((err) => {
|
||||
core.setFailed(
|
||||
'Codecov: Failed to properly upload: ' +
|
||||
`${err.message}`,
|
||||
);
|
||||
return;
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue