Merge pull request #440 from codecov/2.0.2-token-fixes

2.0.2 token fixes
This commit is contained in:
Tom Hu
2021-07-23 07:48:24 -07:00
committed by GitHub
6 changed files with 50 additions and 38 deletions

View File

@@ -1,3 +1,9 @@
## 2.0.2
### Fixes
- Underlying uploader fixes issues with tokens not being sent properly for users seeing
`Error!: Error: Error uploading to https://codecov.io: Error: Error uploading to Codecov: Error: Not Found`
- #440 fix: Validation ordering
## 2.0.1 ## 2.0.1
### Fixes ### Fixes
- #424 fix: Issue in building all deep dependencies - #424 fix: Issue in building all deep dependencies

35
dist/index.js vendored
View File

@@ -12849,7 +12849,7 @@ var core = __nccwpck_require__(2186);
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js // EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
var github = __nccwpck_require__(5438); var github = __nccwpck_require__(5438);
;// CONCATENATED MODULE: ./package.json ;// CONCATENATED MODULE: ./package.json
const package_namespaceObject = {"i8":"2.0.1"}; const package_namespaceObject = {"i8":"2.0.2"};
;// CONCATENATED MODULE: ./src/buildExec.ts ;// CONCATENATED MODULE: ./src/buildExec.ts
@@ -13061,22 +13061,23 @@ const verify = (filename) => __awaiter(void 0, void 0, void 0, function* () {
else { else {
setFailure('Codecov: Error validating SHASUM signature', true); setFailure('Codecov: Error validating SHASUM signature', true);
} }
// Verify uploader const calculateHash = (filename) => __awaiter(void 0, void 0, void 0, function* () {
const uploaderSha = external_crypto_.createHash(`sha256`); const stream = external_fs_.createReadStream(filename);
const stream = external_fs_.createReadStream(filename); const uploaderSha = external_crypto_.createHash(`sha256`);
yield stream stream.pipe(uploaderSha);
.on('data', (data) => { return new Promise((resolve, reject) => {
uploaderSha.update(data); stream.on('end', () => resolve(`${uploaderSha.digest('hex')} ${uploaderName}`));
}).on('end', () => __awaiter(void 0, void 0, void 0, function* () { stream.on('error', reject);
const hash = `${uploaderSha.digest('hex')} ${uploaderName}`; });
if (hash !== shasum) { });
setFailure('Codecov: Uploader shasum does not match ' + const hash = yield calculateHash(filename);
`uploader hash: ${hash}, public hash: ${shasum}`, true); if (hash === shasum) {
} core.info(`==> Uploader SHASUM verified (${hash})`);
else { }
core.info('==> Uploader SHASUM verified'); else {
} setFailure('Codecov: Uploader shasum does not match -- ' +
})); `uploader hash: ${hash}, public hash: ${shasum}`, true);
}
} }
catch (err) { catch (err) {
setFailure(`Codecov: Error validating uploader: ${err.message}`, true); setFailure(`Codecov: Error validating uploader: ${err.message}`, true);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "codecov-action", "name": "codecov-action",
"version": "2.0.1", "version": "2.0.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "codecov-action", "name": "codecov-action",
"version": "2.0.1", "version": "2.0.2",
"description": "Upload coverage reports to Codecov from GitHub Actions", "description": "Upload coverage reports to Codecov from GitHub Actions",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@@ -44,24 +44,29 @@ const verify = async (filename: string) => {
setFailure('Codecov: Error validating SHASUM signature', true); setFailure('Codecov: Error validating SHASUM signature', true);
} }
// Verify uploader const calculateHash = async (filename: string) => {
const uploaderSha = crypto.createHash(`sha256`); const stream = fs.createReadStream(filename);
const stream = fs.createReadStream(filename); const uploaderSha = crypto.createHash(`sha256`);
await stream stream.pipe(uploaderSha);
.on('data', (data) => {
uploaderSha.update(data); return new Promise((resolve, reject) => {
}).on('end', async () => { stream.on('end', () => resolve(
const hash = `${uploaderSha.digest('hex')} ${uploaderName}`; `${uploaderSha.digest('hex')} ${uploaderName}`,
if (hash !== shasum) { ));
setFailure( stream.on('error', reject);
'Codecov: Uploader shasum does not match ' + });
`uploader hash: ${hash}, public hash: ${shasum}`, };
true,
); const hash = await calculateHash(filename);
} else { if (hash === shasum) {
core.info('==> Uploader SHASUM verified'); core.info(`==> Uploader SHASUM verified (${hash})`);
} } else {
}); setFailure(
'Codecov: Uploader shasum does not match -- ' +
`uploader hash: ${hash}, public hash: ${shasum}`,
true,
);
}
} catch (err) { } catch (err) {
setFailure(`Codecov: Error validating uploader: ${err.message}`, true); setFailure(`Codecov: Error validating uploader: ${err.message}`, true);
} }