Compare commits

...

15 Commits

Author SHA1 Message Date
Tom Hu
c16abc29c9 chore(release): 4.1.1 (#1344) 2024-03-26 10:58:49 -04:00
Martin Kröning
3e33441c19 fix: typo in disable_safe_directory (#1343)
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-03-26 09:58:36 -04:00
dependabot[bot]
85aacc9654 build(deps): bump github/codeql-action from 3.24.7 to 3.24.9 (#1341)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.7 to 3.24.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3.24.7...v3.24.9)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 13:08:34 -04:00
dependabot[bot]
4ea9be0fa3 build(deps): bump undici from 5.28.2 to 5.28.3 (#1338)
Bumps [undici](https://github.com/nodejs/undici) from 5.28.2 to 5.28.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.2...v5.28.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-22 09:19:53 -07:00
dependabot[bot]
164fadeaa7 build(deps-dev): bump typescript from 5.4.2 to 5.4.3 (#1334)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.4.2 to 5.4.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.2...v5.4.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 09:54:34 -07:00
Tom Hu
4621ecce09 fix: force version (#1329) 2024-03-19 08:19:47 -04:00
dependabot[bot]
251ba34669 build(deps): bump actions/checkout from 4.1.1 to 4.1.2 (#1331)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.1...v4.1.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-18 09:54:20 -07:00
dependabot[bot]
5a593a5341 build(deps): bump github/codeql-action from 3.24.6 to 3.24.7 (#1332)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.6 to 3.24.7.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3.24.6...v3.24.7)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-18 09:52:25 -07:00
Joe Becher
a15c0e43ca Removed mention of Mercurial (#1325)
To my knowledge , none of Codecov's supported code hosts support Mercurial, nor does the CLI itself.
2024-03-12 08:16:21 -07:00
dependabot[bot]
8be6ba5782 build(deps-dev): bump typescript from 5.3.3 to 5.4.2 (#1319)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.3.3 to 5.4.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.3.3...v5.4.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-07 09:59:40 -08:00
dependabot[bot]
e774838850 build(deps): bump github/codeql-action from 3.24.5 to 3.24.6 (#1315)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.5 to 3.24.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3.24.5...v3.24.6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-04 11:43:11 -08:00
Tom Hu
54bcd8715e chore(release): v4.1.0 (#1307) 2024-02-26 11:44:43 -08:00
dependabot[bot]
8ba77ef8d7 build(deps-dev): bump eslint from 8.56.0 to 8.57.0 (#1305)
Bumps [eslint](https://github.com/eslint/eslint) from 8.56.0 to 8.57.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.56.0...v8.57.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 11:32:43 -08:00
dependabot[bot]
c60aa801e3 build(deps): bump github/codeql-action from 3.24.3 to 3.24.5 (#1306)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.24.3 to 3.24.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3.24.3...v3.24.5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 11:32:18 -08:00
Tom Hu
2fc4847d3f fix: set safe directory (#1304)
* fix: set safe directory

* fix: naming

* fix: update tests

* fix: dont even check

* fix: add set safe directory

* fix: write test for setSafeDirectory
2024-02-26 11:31:39 -08:00
15 changed files with 231 additions and 90 deletions

View File

@@ -37,11 +37,11 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3.24.3 uses: github/codeql-action/init@v3.24.9
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,7 +52,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v3.24.3 uses: github/codeql-action/autobuild@v3.24.9
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 https://git.io/JvXDl
@@ -66,4 +66,4 @@ jobs:
# make release # make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.24.3 uses: github/codeql-action/analyze@v3.24.9

View File

@@ -8,7 +8,47 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-xlarge] os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-xlarge]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.2
- name: Install dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Run tests and collect coverage
run: npm run test
- name: Upload coverage to Codecov (script)
uses: ./
with:
files: ./coverage/script/coverage-final.json
flags: script,${{ matrix.os }}
name: codecov-script
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov (demo)
uses: ./
with:
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
file: ./coverage/coverage-final.json
flags: demo,${{ matrix.os }}
name: codecov-demo
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov (version)
uses: ./
with:
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
file: ./coverage/coverage-final.json
flags: version,${{ matrix.os }}
name: codecov-version
version: v0.2.0
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
run-container:
runs-on: ubuntu-latest
container: node:18
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install
- name: Lint - name: Lint

View File

@@ -24,7 +24,7 @@ jobs:
steps: steps:
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@v4.1.1 # v3.0.0 uses: actions/checkout@v4.1.2 # v3.0.0
with: with:
persist-credentials: false persist-credentials: false
@@ -56,6 +56,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard. # Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v3.24.3 # v1.0.26 uses: github/codeql-action/upload-sarif@v3.24.9 # v1.0.26
with: with:
sarif_file: results.sarif sarif_file: results.sarif

View File

@@ -95,7 +95,7 @@ Codecov's Action supports inputs from the user. These inputs, along with their d
| `plugin` | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional | `plugin` | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional
| `plugins` | Comma-separated list of plugins for use during upload. | Optional | `plugins` | Comma-separated list of plugins for use during upload. | Optional
| `report_code` | The code of the report. If unsure, do not include | Optional | `report_code` | The code of the report. If unsure, do not include | Optional
| `root_dir` | Used when not in git/hg project to identify project root directory | Optional | `root_dir` | Used to specify the location of your .git root to identify project root directory | Optional
| `slug` | Specify the slug manually (Enterprise use) | Optional | `slug` | Specify the slug manually (Enterprise use) | Optional
| `url` | Specify the base url to upload (Enterprise use) | Optional | `url` | Specify the base url to upload (Enterprise use) | Optional
| `use_legacy_upload_endpoint` | Use the legacy upload endpoint | Optional | `use_legacy_upload_endpoint` | Use the legacy upload endpoint | Optional

View File

@@ -14,11 +14,14 @@ inputs:
directory: directory:
description: 'Directory to search for coverage reports.' description: 'Directory to search for coverage reports.'
required: false required: false
disable_file_fixes:
description: 'Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets)'
required: false
disable_search: disable_search:
description: 'Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option.' description: 'Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option.'
required: false required: false
disable_file_fixes: disable_safe_directory:
description: 'Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets)' description: 'Disable setting safe directory. Set to true to disable.'
required: false required: false
dry_run: dry_run:
description: "Don't upload files to Codecov" description: "Don't upload files to Codecov"
@@ -41,6 +44,9 @@ inputs:
flags: flags:
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)' description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
required: false required: false
git_service:
description: 'Override the git_service (e.g. github_enterprise)'
required: false
handle_no_reports_found: handle_no_reports_found:
description: 'Raise no exceptions when no coverage reports found' description: 'Raise no exceptions when no coverage reports found'
required: false required: false

60
dist/index.js vendored
View File

@@ -21064,6 +21064,9 @@ function httpRedirectFetch (fetchParams, response) {
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
request.headersList.delete('authorization') request.headersList.delete('authorization')
// https://fetch.spec.whatwg.org/#authentication-entries
request.headersList.delete('proxy-authorization', true)
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
request.headersList.delete('cookie') request.headersList.delete('cookie')
request.headersList.delete('host') request.headersList.delete('host')
@@ -32261,6 +32264,7 @@ const isTrue = (variable) => {
}; };
const buildCommitExec = () => { const buildCommitExec = () => {
const commitParent = core.getInput('commit_parent'); const commitParent = core.getInput('commit_parent');
const gitService = core.getInput('git_service');
const overrideBranch = core.getInput('override_branch'); const overrideBranch = core.getInput('override_branch');
const overrideCommit = core.getInput('override_commit'); const overrideCommit = core.getInput('override_commit');
const overridePr = core.getInput('override_pr'); const overridePr = core.getInput('override_pr');
@@ -32285,6 +32289,7 @@ const buildCommitExec = () => {
if (commitParent) { if (commitParent) {
commitExecArgs.push('--parent-sha', `${commitParent}`); commitExecArgs.push('--parent-sha', `${commitParent}`);
} }
commitExecArgs.push('--git-service', `${gitService ? gitService : 'github'}`);
if (overrideBranch) { if (overrideBranch) {
commitExecArgs.push('-B', `${overrideBranch}`); commitExecArgs.push('-B', `${overrideBranch}`);
} }
@@ -32329,6 +32334,7 @@ const buildGeneralExec = () => {
return { args, verbose }; return { args, verbose };
}; };
const buildReportExec = () => { const buildReportExec = () => {
const gitService = core.getInput('git_service');
const overrideCommit = core.getInput('override_commit'); const overrideCommit = core.getInput('override_commit');
const overridePr = core.getInput('override_pr'); const overridePr = core.getInput('override_pr');
const slug = core.getInput('slug'); const slug = core.getInput('slug');
@@ -32349,6 +32355,7 @@ const buildReportExec = () => {
if (token) { if (token) {
reportOptions.env.CODECOV_TOKEN = token; reportOptions.env.CODECOV_TOKEN = token;
} }
reportExecArgs.push('--git-service', `${gitService ? gitService : 'github'}`);
if (overrideCommit) { if (overrideCommit) {
reportExecArgs.push('-C', `${overrideCommit}`); reportExecArgs.push('-C', `${overrideCommit}`);
} }
@@ -32375,6 +32382,7 @@ const buildReportExec = () => {
}; };
const buildUploadExec = () => { const buildUploadExec = () => {
const disableFileFixes = isTrue(core.getInput('disable_file_fixes')); const disableFileFixes = isTrue(core.getInput('disable_file_fixes'));
const disableSafeDirectory = isTrue(core.getInput('disable_safe_directory'));
const disableSearch = isTrue(core.getInput('disable_search')); const disableSearch = isTrue(core.getInput('disable_search'));
const dryRun = isTrue(core.getInput('dry_run')); const dryRun = isTrue(core.getInput('dry_run'));
const envVars = core.getInput('env_vars'); const envVars = core.getInput('env_vars');
@@ -32383,6 +32391,7 @@ const buildUploadExec = () => {
const file = core.getInput('file'); const file = core.getInput('file');
const files = core.getInput('files'); const files = core.getInput('files');
const flags = core.getInput('flags'); const flags = core.getInput('flags');
const gitService = core.getInput('git_service');
const handleNoReportsFound = isTrue(core.getInput('handle_no_reports_found')); const handleNoReportsFound = isTrue(core.getInput('handle_no_reports_found'));
const jobCode = core.getInput('job_code'); const jobCode = core.getInput('job_code');
const name = core.getInput('name'); const name = core.getInput('name');
@@ -32455,6 +32464,7 @@ const buildUploadExec = () => {
uploadExecArgs.push('-F', `${f}`); uploadExecArgs.push('-F', `${f}`);
}); });
} }
uploadExecArgs.push('--git-service', `${gitService ? gitService : 'github'}`);
if (handleNoReportsFound) { if (handleNoReportsFound) {
uploadExecArgs.push('--handle-no-reports-found'); uploadExecArgs.push('--handle-no-reports-found');
} }
@@ -32518,6 +32528,7 @@ const buildUploadExec = () => {
return { return {
uploadExecArgs, uploadExecArgs,
uploadOptions, uploadOptions,
disableSafeDirectory,
failCi, failCi,
os, os,
uploaderVersion, uploaderVersion,
@@ -32527,6 +32538,16 @@ const buildUploadExec = () => {
;// CONCATENATED MODULE: ./src/helpers.ts ;// CONCATENATED MODULE: ./src/helpers.ts
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const PLATFORMS = [ const PLATFORMS = [
'linux', 'linux',
@@ -32578,6 +32599,18 @@ const getCommand = (filename, generalArgs, command) => {
core.info(`==> Running command '${fullCommand.join(' ')}'`); core.info(`==> Running command '${fullCommand.join(' ')}'`);
return fullCommand; return fullCommand;
}; };
const setSafeDirectory = () => __awaiter(void 0, void 0, void 0, function* () {
const command = ([
'git',
'config',
'--global',
'--add',
'safe.directory',
`${process.env['GITHUB_WORKSPACE']}`,
].join(' '));
core.info(`==> Running ${command}`);
yield exec.exec(command);
});
// EXTERNAL MODULE: external "crypto" // EXTERNAL MODULE: external "crypto"
@@ -32587,7 +32620,7 @@ var gpg = __nccwpck_require__(40);
// EXTERNAL MODULE: ./node_modules/undici/index.js // EXTERNAL MODULE: ./node_modules/undici/index.js
var undici = __nccwpck_require__(1773); var undici = __nccwpck_require__(1773);
;// CONCATENATED MODULE: ./src/validate.ts ;// CONCATENATED MODULE: ./src/validate.ts
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { var validate_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -32603,7 +32636,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
const verify = (filename, platform, version, verbose, failCi) => __awaiter(void 0, void 0, void 0, function* () { const verify = (filename, platform, version, verbose, failCi) => validate_awaiter(void 0, void 0, void 0, function* () {
try { try {
const uploaderName = getUploaderName(platform); const uploaderName = getUploaderName(platform);
// Get SHASUM and SHASUM signature files // Get SHASUM and SHASUM signature files
@@ -32620,8 +32653,8 @@ const verify = (filename, platform, version, verbose, failCi) => __awaiter(void
console.log(`Received SHA256SUM signature ${shaSig}`); console.log(`Received SHA256SUM signature ${shaSig}`);
} }
yield external_fs_.writeFileSync(external_path_.join(__dirname, `${uploaderName}.SHA256SUM.sig`), shaSig); yield external_fs_.writeFileSync(external_path_.join(__dirname, `${uploaderName}.SHA256SUM.sig`), shaSig);
const validateSha = () => __awaiter(void 0, void 0, void 0, function* () { const validateSha = () => validate_awaiter(void 0, void 0, void 0, function* () {
const calculateHash = (filename) => __awaiter(void 0, void 0, void 0, function* () { const calculateHash = (filename) => validate_awaiter(void 0, void 0, void 0, function* () {
const stream = external_fs_.createReadStream(filename); const stream = external_fs_.createReadStream(filename);
const uploaderSha = external_crypto_.createHash(`sha256`); const uploaderSha = external_crypto_.createHash(`sha256`);
stream.pipe(uploaderSha); stream.pipe(uploaderSha);
@@ -32646,7 +32679,7 @@ const verify = (filename, platform, version, verbose, failCi) => __awaiter(void
'--verify', '--verify',
external_path_.join(__dirname, `${uploaderName}.SHA256SUM.sig`), external_path_.join(__dirname, `${uploaderName}.SHA256SUM.sig`),
external_path_.join(__dirname, `${uploaderName}.SHA256SUM`), external_path_.join(__dirname, `${uploaderName}.SHA256SUM`),
], (err, verifyResult) => __awaiter(void 0, void 0, void 0, function* () { ], (err, verifyResult) => validate_awaiter(void 0, void 0, void 0, function* () {
if (err) { if (err) {
setFailure('Codecov: Error importing pgp key', failCi); setFailure('Codecov: Error importing pgp key', failCi);
} }
@@ -32661,7 +32694,7 @@ const verify = (filename, platform, version, verbose, failCi) => __awaiter(void
'--no-default-keyring', '--no-default-keyring',
'--import', '--import',
__nccwpck_require__.ab + "pgp_keys.asc", __nccwpck_require__.ab + "pgp_keys.asc",
], (err, importResult) => __awaiter(void 0, void 0, void 0, function* () { ], (err, importResult) => validate_awaiter(void 0, void 0, void 0, function* () {
if (err) { if (err) {
setFailure('Codecov: Error importing pgp key', failCi); setFailure('Codecov: Error importing pgp key', failCi);
} }
@@ -32688,11 +32721,9 @@ var version_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
const versionInfo = (platform, version) => version_awaiter(void 0, void 0, void 0, function* () { const versionInfo = (platform, version) => version_awaiter(void 0, void 0, void 0, function* () {
if (version) { core.info(`==> Running version ${version}`);
core.info(`==> Running version ${version}`);
}
try { try {
const metadataRes = yield (0,undici.request)(`https://cli.codecov.io/${platform}/latest`, { const metadataRes = yield (0,undici.request)(`https://cli.codecov.io/${platform}/${version}`, {
headers: { 'Accept': 'application/json' }, headers: { 'Accept': 'application/json' },
}); });
const metadata = yield metadataRes.body.json(); const metadata = yield metadataRes.body.json();
@@ -32726,7 +32757,7 @@ let failCi;
try { try {
const { commitExecArgs, commitOptions, commitCommand } = buildCommitExec(); const { commitExecArgs, commitOptions, commitCommand } = buildCommitExec();
const { reportExecArgs, reportOptions, reportCommand } = buildReportExec(); const { reportExecArgs, reportOptions, reportCommand } = buildReportExec();
const { uploadExecArgs, uploadOptions, failCi, os, uploaderVersion, uploadCommand, } = buildUploadExec(); const { uploadExecArgs, uploadOptions, disableSafeDirectory, failCi, os, uploaderVersion, uploadCommand, } = buildUploadExec();
const { args, verbose } = buildGeneralExec(); const { args, verbose } = buildGeneralExec();
const platform = getPlatform(os); const platform = getPlatform(os);
const filename = external_path_.join(__dirname, getUploaderName(platform)); const filename = external_path_.join(__dirname, getUploaderName(platform));
@@ -32742,6 +32773,9 @@ try {
yield validate(filename, platform, uploaderVersion, verbose, failCi); yield validate(filename, platform, uploaderVersion, verbose, failCi);
yield version(platform, uploaderVersion); yield version(platform, uploaderVersion);
yield external_fs_.chmodSync(filename, '777'); yield external_fs_.chmodSync(filename, '777');
if (!disableSafeDirectory) {
yield setSafeDirectory();
}
const unlink = () => { const unlink = () => {
external_fs_.unlink(filename, (err) => { external_fs_.unlink(filename, (err) => {
if (err) { if (err) {
@@ -32752,7 +32786,7 @@ try {
const doUpload = () => src_awaiter(void 0, void 0, void 0, function* () { const doUpload = () => src_awaiter(void 0, void 0, void 0, function* () {
yield exec.exec(getCommand(filename, args, uploadCommand).join(' '), uploadExecArgs, uploadOptions) yield exec.exec(getCommand(filename, args, uploadCommand).join(' '), uploadExecArgs, uploadOptions)
.catch((err) => { .catch((err) => {
setFailure(`Codecov: setFailure(`Codecov:
Failed to properly upload report: ${err.message}`, failCi); Failed to properly upload report: ${err.message}`, failCi);
}); });
}); });
@@ -32763,7 +32797,7 @@ try {
yield doUpload(); yield doUpload();
} }
})).catch((err) => { })).catch((err) => {
setFailure(`Codecov: setFailure(`Codecov:
Failed to properly create report: ${err.message}`, failCi); Failed to properly create report: ${err.message}`, failCi);
}); });
}); });

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

98
package-lock.json generated
View File

@@ -1,31 +1,31 @@
{ {
"name": "codecov-action", "name": "codecov-action",
"version": "4.0.2", "version": "4.1.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "codecov-action", "name": "codecov-action",
"version": "4.0.2", "version": "4.1.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"gpg": "^0.6.0", "gpg": "^0.6.0",
"undici": "5.28.2" "undici": "5.28.3"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^6.21.0", "@typescript-eslint/parser": "^6.21.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"eslint-config-google": "^0.14.0", "eslint-config-google": "^0.14.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-junit": "^16.0.0", "jest-junit": "^16.0.0",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"typescript": "^5.3.3" "typescript": "^5.4.3"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {
@@ -795,9 +795,9 @@
} }
}, },
"node_modules/@eslint/js": { "node_modules/@eslint/js": {
"version": "8.56.0", "version": "8.57.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz",
"integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -812,13 +812,13 @@
} }
}, },
"node_modules/@humanwhocodes/config-array": { "node_modules/@humanwhocodes/config-array": {
"version": "0.11.13", "version": "0.11.14",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
"integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@humanwhocodes/object-schema": "^2.0.1", "@humanwhocodes/object-schema": "^2.0.2",
"debug": "^4.1.1", "debug": "^4.3.1",
"minimatch": "^3.0.5" "minimatch": "^3.0.5"
}, },
"engines": { "engines": {
@@ -839,9 +839,9 @@
} }
}, },
"node_modules/@humanwhocodes/object-schema": { "node_modules/@humanwhocodes/object-schema": {
"version": "2.0.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz",
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==",
"dev": true "dev": true
}, },
"node_modules/@istanbuljs/load-nyc-config": { "node_modules/@istanbuljs/load-nyc-config": {
@@ -2691,16 +2691,16 @@
} }
}, },
"node_modules/eslint": { "node_modules/eslint": {
"version": "8.56.0", "version": "8.57.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz",
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1", "@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.4", "@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.56.0", "@eslint/js": "8.57.0",
"@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/config-array": "^0.11.14",
"@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8", "@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0", "@ungap/structured-clone": "^1.2.0",
@@ -5103,9 +5103,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.3.3", "version": "5.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -5116,9 +5116,9 @@
} }
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "5.28.2", "version": "5.28.3",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz",
"integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==",
"dependencies": { "dependencies": {
"@fastify/busboy": "^2.0.0" "@fastify/busboy": "^2.0.0"
}, },
@@ -5915,9 +5915,9 @@
} }
}, },
"@eslint/js": { "@eslint/js": {
"version": "8.56.0", "version": "8.57.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz",
"integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==",
"dev": true "dev": true
}, },
"@fastify/busboy": { "@fastify/busboy": {
@@ -5926,13 +5926,13 @@
"integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==" "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ=="
}, },
"@humanwhocodes/config-array": { "@humanwhocodes/config-array": {
"version": "0.11.13", "version": "0.11.14",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz",
"integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@humanwhocodes/object-schema": "^2.0.1", "@humanwhocodes/object-schema": "^2.0.2",
"debug": "^4.1.1", "debug": "^4.3.1",
"minimatch": "^3.0.5" "minimatch": "^3.0.5"
} }
}, },
@@ -5943,9 +5943,9 @@
"dev": true "dev": true
}, },
"@humanwhocodes/object-schema": { "@humanwhocodes/object-schema": {
"version": "2.0.1", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz",
"integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==",
"dev": true "dev": true
}, },
"@istanbuljs/load-nyc-config": { "@istanbuljs/load-nyc-config": {
@@ -7292,16 +7292,16 @@
"dev": true "dev": true
}, },
"eslint": { "eslint": {
"version": "8.56.0", "version": "8.57.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz",
"integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1", "@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.4", "@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.56.0", "@eslint/js": "8.57.0",
"@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/config-array": "^0.11.14",
"@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8", "@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0", "@ungap/structured-clone": "^1.2.0",
@@ -9047,15 +9047,15 @@
"dev": true "dev": true
}, },
"typescript": { "typescript": {
"version": "5.3.3", "version": "5.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==",
"dev": true "dev": true
}, },
"undici": { "undici": {
"version": "5.28.2", "version": "5.28.3",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz",
"integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==",
"requires": { "requires": {
"@fastify/busboy": "^2.0.0" "@fastify/busboy": "^2.0.0"
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "codecov-action", "name": "codecov-action",
"version": "4.0.2", "version": "4.1.1",
"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": {
@@ -27,18 +27,18 @@
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"gpg": "^0.6.0", "gpg": "^0.6.0",
"undici": "5.28.2" "undici": "5.28.3"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^6.21.0", "@typescript-eslint/parser": "^6.21.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"eslint-config-google": "^0.14.0", "eslint-config-google": "^0.14.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-junit": "^16.0.0", "jest-junit": "^16.0.0",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"typescript": "^5.3.3" "typescript": "^5.4.3"
} }
} }

View File

@@ -38,7 +38,10 @@ test('general args', () => {
test('upload args using context', () => { test('upload args using context', () => {
const expectedArgs = []; const expectedArgs = [
'--git-service',
'github',
];
const {uploadExecArgs, uploadCommand} = buildUploadExec(); const {uploadExecArgs, uploadCommand} = buildUploadExec();
if (context.eventName == 'pull_request') { if (context.eventName == 'pull_request') {
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`); expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
@@ -65,6 +68,7 @@ test('upload args', () => {
'file': 'coverage.xml', 'file': 'coverage.xml',
'files': 'dir1/coverage.xml,dir2/coverage.xml', 'files': 'dir1/coverage.xml,dir2/coverage.xml',
'flags': 'test,test2', 'flags': 'test,test2',
'git_service': 'github_enterprise',
'handle_no_reports_found': 'true', 'handle_no_reports_found': 'true',
'job_code': '32', 'job_code': '32',
'name': 'codecov', 'name': 'codecov',
@@ -110,6 +114,8 @@ test('upload args', () => {
'test', 'test',
'-F', '-F',
'test2', 'test2',
'--git-service',
'github_enterprise',
'--handle-no-reports-found', '--handle-no-reports-found',
'--job-code', '--job-code',
'32', '32',
@@ -152,6 +158,7 @@ test('upload args', () => {
test('report args', () => { test('report args', () => {
const envs = { const envs = {
git_service: 'github_enterprise',
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244', override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
override_pr: 'fakePR', override_pr: 'fakePR',
slug: 'fakeOwner/fakeRepo', slug: 'fakeOwner/fakeRepo',
@@ -165,6 +172,8 @@ test('report args', () => {
const {reportExecArgs, reportCommand} = buildReportExec(); const {reportExecArgs, reportCommand} = buildReportExec();
const expectedArgs = [ const expectedArgs = [
'--git-service',
'github_enterprise',
'-C', '-C',
'9caabca5474b49de74ef5667deabaf74cdacc244', '9caabca5474b49de74ef5667deabaf74cdacc244',
'-P', '-P',
@@ -189,7 +198,10 @@ test('report args using context', () => {
for (const env of Object.keys(envs)) { for (const env of Object.keys(envs)) {
process.env['INPUT_' + env.toUpperCase()] = envs[env]; process.env['INPUT_' + env.toUpperCase()] = envs[env];
} }
const expectedArgs : string[] = []; const expectedArgs : string[] = [
'--git-service',
'github',
];
if (context.eventName == 'pull_request') { if (context.eventName == 'pull_request') {
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`); expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
} }
@@ -206,6 +218,7 @@ test('report args using context', () => {
test('commit args', () => { test('commit args', () => {
const envs = { const envs = {
git_service: 'github_enterprise',
commit_parent: '83231650328f11695dfb754ca0f540516f188d27', commit_parent: '83231650328f11695dfb754ca0f540516f188d27',
override_branch: 'thomasrockhu/test', override_branch: 'thomasrockhu/test',
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244', override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
@@ -222,6 +235,8 @@ test('commit args', () => {
const expectedArgs = [ const expectedArgs = [
'--parent-sha', '--parent-sha',
'83231650328f11695dfb754ca0f540516f188d27', '83231650328f11695dfb754ca0f540516f188d27',
'--git-service',
'github_enterprise',
'-B', '-B',
'thomasrockhu/test', 'thomasrockhu/test',
'-C', '-C',
@@ -241,7 +256,10 @@ test('commit args', () => {
}); });
test('commit args using context', () => { test('commit args using context', () => {
const expectedArgs :string[] = []; const expectedArgs :string[] = [
'--git-service',
'github',
];
const {commitExecArgs, commitCommand} = buildCommitExec(); const {commitExecArgs, commitCommand} = buildCommitExec();
if (context.eventName == 'pull_request') { if (context.eventName == 'pull_request') {

View File

@@ -20,6 +20,7 @@ const isTrue = (variable) => {
const buildCommitExec = () => { const buildCommitExec = () => {
const commitParent = core.getInput('commit_parent'); const commitParent = core.getInput('commit_parent');
const gitService = core.getInput('git_service');
const overrideBranch = core.getInput('override_branch'); const overrideBranch = core.getInput('override_branch');
const overrideCommit = core.getInput('override_commit'); const overrideCommit = core.getInput('override_commit');
const overridePr = core.getInput('override_pr'); const overridePr = core.getInput('override_pr');
@@ -48,6 +49,7 @@ const buildCommitExec = () => {
if (commitParent) { if (commitParent) {
commitExecArgs.push('--parent-sha', `${commitParent}`); commitExecArgs.push('--parent-sha', `${commitParent}`);
} }
commitExecArgs.push('--git-service', `${gitService ? gitService : 'github'}`);
if (overrideBranch) { if (overrideBranch) {
commitExecArgs.push('-B', `${overrideBranch}`); commitExecArgs.push('-B', `${overrideBranch}`);
@@ -100,6 +102,7 @@ const buildGeneralExec = () => {
}; };
const buildReportExec = () => { const buildReportExec = () => {
const gitService = core.getInput('git_service');
const overrideCommit = core.getInput('override_commit'); const overrideCommit = core.getInput('override_commit');
const overridePr = core.getInput('override_pr'); const overridePr = core.getInput('override_pr');
const slug = core.getInput('slug'); const slug = core.getInput('slug');
@@ -125,6 +128,8 @@ const buildReportExec = () => {
if (token) { if (token) {
reportOptions.env.CODECOV_TOKEN = token; reportOptions.env.CODECOV_TOKEN = token;
} }
reportExecArgs.push('--git-service', `${gitService ? gitService : 'github'}`);
if (overrideCommit) { if (overrideCommit) {
reportExecArgs.push('-C', `${overrideCommit}`); reportExecArgs.push('-C', `${overrideCommit}`);
} else if ( } else if (
@@ -155,6 +160,7 @@ const buildReportExec = () => {
const buildUploadExec = () => { const buildUploadExec = () => {
const disableFileFixes = isTrue(core.getInput('disable_file_fixes')); const disableFileFixes = isTrue(core.getInput('disable_file_fixes'));
const disableSafeDirectory = isTrue(core.getInput('disable_safe_directory'));
const disableSearch = isTrue(core.getInput('disable_search')); const disableSearch = isTrue(core.getInput('disable_search'));
const dryRun = isTrue(core.getInput('dry_run')); const dryRun = isTrue(core.getInput('dry_run'));
const envVars = core.getInput('env_vars'); const envVars = core.getInput('env_vars');
@@ -163,6 +169,7 @@ const buildUploadExec = () => {
const file = core.getInput('file'); const file = core.getInput('file');
const files = core.getInput('files'); const files = core.getInput('files');
const flags = core.getInput('flags'); const flags = core.getInput('flags');
const gitService = core.getInput('git_service');
const handleNoReportsFound = isTrue(core.getInput('handle_no_reports_found')); const handleNoReportsFound = isTrue(core.getInput('handle_no_reports_found'));
const jobCode = core.getInput('job_code'); const jobCode = core.getInput('job_code');
const name = core.getInput('name'); const name = core.getInput('name');
@@ -239,6 +246,7 @@ const buildUploadExec = () => {
uploadExecArgs.push('-F', `${f}`); uploadExecArgs.push('-F', `${f}`);
}); });
} }
uploadExecArgs.push('--git-service', `${gitService ? gitService : 'github'}`);
if (handleNoReportsFound) { if (handleNoReportsFound) {
uploadExecArgs.push('--handle-no-reports-found'); uploadExecArgs.push('--handle-no-reports-found');
} }
@@ -305,6 +313,7 @@ const buildUploadExec = () => {
return { return {
uploadExecArgs, uploadExecArgs,
uploadOptions, uploadOptions,
disableSafeDirectory,
failCi, failCi,
os, os,
uploaderVersion, uploaderVersion,

View File

@@ -1,10 +1,13 @@
import * as exec from '@actions/exec';
import { import {
PLATFORMS,
getBaseUrl, getBaseUrl,
getCommand,
getPlatform, getPlatform,
isValidPlatform, isValidPlatform,
isWindows, isWindows,
PLATFORMS, setSafeDirectory,
getCommand,
} from './helpers'; } from './helpers';
let OLDOS = process.env.RUNNER_OS; let OLDOS = process.env.RUNNER_OS;
@@ -78,3 +81,16 @@ test('getCommand', () => {
expect(getCommand('path', ['-v', '-x'], 'do-upload')) expect(getCommand('path', ['-v', '-x'], 'do-upload'))
.toEqual(['path', '-v', '-x', 'do-upload']); .toEqual(['path', '-v', '-x', 'do-upload']);
}); });
test('setSafeDirectory', async () => {
process.env.GITHUB_WORKSPACE = 'testOrg/testRepo';
await setSafeDirectory();
const testSafeDirectory = ([
'git',
'config',
'--get',
'safe.directory',
]).join(' ');
const safeDirectory = await exec.getExecOutput(testSafeDirectory);
expect(safeDirectory.stdout).toBe('testOrg/testRepo\n');
});

View File

@@ -1,4 +1,5 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as exec from '@actions/exec';
const PLATFORMS = [ const PLATFORMS = [
'linux', 'linux',
@@ -64,6 +65,19 @@ const getCommand = (
return fullCommand; return fullCommand;
}; };
const setSafeDirectory = async () => {
const command = ([
'git',
'config',
'--global',
'--add',
'safe.directory',
`${process.env['GITHUB_WORKSPACE']}`,
].join(' '));
core.info(`==> Running ${command}`);
await exec.exec(command);
};
export { export {
PLATFORMS, PLATFORMS,
getBaseUrl, getBaseUrl,
@@ -72,5 +86,6 @@ export {
isValidPlatform, isValidPlatform,
isWindows, isWindows,
setFailure, setFailure,
setSafeDirectory,
getCommand, getCommand,
}; };

View File

@@ -12,10 +12,11 @@ import {
} from './buildExec'; } from './buildExec';
import { import {
getBaseUrl, getBaseUrl,
getCommand,
getPlatform, getPlatform,
getUploaderName, getUploaderName,
setFailure, setFailure,
getCommand, setSafeDirectory,
} from './helpers'; } from './helpers';
import verify from './validate'; import verify from './validate';
@@ -29,6 +30,7 @@ try {
const { const {
uploadExecArgs, uploadExecArgs,
uploadOptions, uploadOptions,
disableSafeDirectory,
failCi, failCi,
os, os,
uploaderVersion, uploaderVersion,
@@ -55,6 +57,9 @@ try {
await verify(filename, platform, uploaderVersion, verbose, failCi); await verify(filename, platform, uploaderVersion, verbose, failCi);
await versionInfo(platform, uploaderVersion); await versionInfo(platform, uploaderVersion);
await fs.chmodSync(filename, '777'); await fs.chmodSync(filename, '777');
if (!disableSafeDirectory) {
await setSafeDirectory();
}
const unlink = () => { const unlink = () => {
fs.unlink(filename, (err) => { fs.unlink(filename, (err) => {
@@ -72,7 +77,7 @@ try {
uploadOptions) uploadOptions)
.catch((err) => { .catch((err) => {
setFailure( setFailure(
`Codecov: `Codecov:
Failed to properly upload report: ${err.message}`, Failed to properly upload report: ${err.message}`,
failCi, failCi,
); );
@@ -89,7 +94,7 @@ try {
} }
}).catch((err) => { }).catch((err) => {
setFailure( setFailure(
`Codecov: `Codecov:
Failed to properly create report: ${err.message}`, Failed to properly create report: ${err.message}`,
failCi, failCi,
); );

View File

@@ -3,14 +3,12 @@ import {request} from 'undici';
const versionInfo = async ( const versionInfo = async (
platform: string, platform: string,
version?: string, version: string,
): Promise<void> => { ): Promise<void> => {
if (version) { core.info(`==> Running version ${version}`);
core.info(`==> Running version ${version}`);
}
try { try {
const metadataRes = await request(`https://cli.codecov.io/${platform}/latest`, { const metadataRes = await request(`https://cli.codecov.io/${platform}/${version}`, {
headers: {'Accept': 'application/json'}, headers: {'Accept': 'application/json'},
}); });
const metadata = await metadataRes.body.json(); const metadata = await metadataRes.body.json();