fix: quick fix to use Promise resolve in getToken

This commit is contained in:
joseph-sentry 2024-08-28 15:48:25 -04:00
commit bc200a8c54
No known key found for this signature in database
7 changed files with 354 additions and 166 deletions

View file

@ -41,7 +41,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.25.13
uses: github/codeql-action/init@v3.26.2
with:
languages: ${{ matrix.language }}
# 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).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3.25.13
uses: github/codeql-action/autobuild@v3.26.2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@ -66,4 +66,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.25.13
uses: github/codeql-action/analyze@v3.26.2

View file

@ -30,7 +30,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif
@ -49,7 +49,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: SARIF file
path: results.sarif
@ -57,6 +57,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v3.25.13 # v1.0.26
uses: github/codeql-action/upload-sarif@v3.26.2 # v1.0.26
with:
sarif_file: results.sarif

120
dist/index.js vendored
View file

@ -32341,14 +32341,13 @@ const getGitService = () => {
};
const isPullRequestFromFork = () => {
core.info(`evenName: ${context.eventName}`);
if (`${context.eventName}` !== 'pull_request' &&
`${context.eventName}` !== 'pull_request_target') {
if (!['pull_request', 'pull_request_target'].includes(context.eventName)) {
return false;
}
const baseLabel = context.payload.pull_request.base.label;
const headLabel = context.payload.pull_request.head.label;
core.info(`baseRef: ${baseLabel} | headRef: ${headLabel}`);
return (baseLabel.split(':')[0] !== headLabel.split(':')[0]);
return baseLabel.split(':')[0] !== headLabel.split(':')[0];
};
const getToken = () => buildExec_awaiter(void 0, void 0, void 0, function* () {
let token = core.getInput('token');
@ -32403,27 +32402,28 @@ const buildCommitExec = () => buildExec_awaiter(void 0, void 0, void 0, function
commitOptions.env.CODECOV_TOKEN = token;
}
if (commitParent) {
commitExecArgs.push('--parent-sha', `${commitParent}`);
commitExecArgs.push('--parent-sha', commitParent);
}
commitExecArgs.push('--git-service', `${gitService}`);
commitExecArgs.push('--git-service', gitService);
if (overrideBranch) {
commitExecArgs.push('-B', `${overrideBranch}`);
commitExecArgs.push('-B', overrideBranch);
}
if (overrideCommit) {
commitExecArgs.push('-C', `${overrideCommit}`);
commitExecArgs.push('-C', overrideCommit);
}
else if (`${context.eventName}` == 'pull_request' ||
`${context.eventName}` == 'pull_request_target') {
commitExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
else if (['pull_request', 'pull_request_target'].includes(context.eventName)) {
const payload = context.payload;
commitExecArgs.push('-C', payload.pull_request.head.sha);
}
if (overridePr) {
commitExecArgs.push('--pr', `${overridePr}`);
commitExecArgs.push('--pr', overridePr);
}
else if (`${context.eventName}` == 'pull_request_target') {
commitExecArgs.push('--pr', `${context.payload.number}`);
else if (context.eventName === 'pull_request_target') {
const payload = context.payload;
commitExecArgs.push('--pr', payload.number.toString());
}
if (slug) {
commitExecArgs.push('--slug', `${slug}`);
commitExecArgs.push('--slug', slug);
}
if (failCi) {
commitExecArgs.push('-Z');
@ -32439,10 +32439,10 @@ const buildGeneralExec = () => {
const verbose = isTrue(core.getInput('verbose'));
const args = [];
if (codecovYmlPath) {
args.push('--codecov-yml-path', `${codecovYmlPath}`);
args.push('--codecov-yml-path', codecovYmlPath);
}
if (url) {
args.push('--enterprise-url', `${url}`);
args.push('--enterprise-url', url);
}
if (verbose) {
args.push('-v');
@ -32471,22 +32471,23 @@ const buildReportExec = () => buildExec_awaiter(void 0, void 0, void 0, function
if (token) {
reportOptions.env.CODECOV_TOKEN = token;
}
reportExecArgs.push('--git-service', `${gitService}`);
reportExecArgs.push('--git-service', gitService);
if (overrideCommit) {
reportExecArgs.push('-C', `${overrideCommit}`);
reportExecArgs.push('-C', overrideCommit);
}
else if (`${context.eventName}` == 'pull_request' ||
`${context.eventName}` == 'pull_request_target') {
reportExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
else if (['pull_request', 'pull_request_target'].includes(context.eventName)) {
const payload = context.payload;
reportExecArgs.push('-C', payload.pull_request.head.sha);
}
if (overridePr) {
reportExecArgs.push('-P', `${overridePr}`);
reportExecArgs.push('-P', overridePr);
}
else if (`${context.eventName}` == 'pull_request_target') {
reportExecArgs.push('-P', `${context.payload.number}`);
else if (context.eventName == 'pull_request_target') {
const payload = context.payload;
reportExecArgs.push('-P', payload.number.toString());
}
if (slug) {
reportExecArgs.push('--slug', `${slug}`);
reportExecArgs.push('--slug', slug);
}
if (failCi) {
reportExecArgs.push('-Z');
@ -32564,83 +32565,94 @@ const buildUploadExec = () => buildExec_awaiter(void 0, void 0, void 0, function
uploadExecArgs.push('-e', envVarsArg.join(','));
}
if (exclude) {
uploadExecArgs.push('--exclude', `${exclude}`);
uploadExecArgs.push('--exclude', exclude);
}
if (failCi) {
uploadExecArgs.push('-Z');
}
if (file) {
uploadExecArgs.push('-f', `${file}`);
uploadExecArgs.push('-f', file);
}
if (files) {
files.split(',').map((f) => f.trim()).forEach((f) => {
if (f.length > 0) { // this handles trailing commas
uploadExecArgs.push('-f', `${f}`);
files
.split(',')
.map((f) => f.trim())
.forEach((f) => {
if (f.length > 0) {
// this handles trailing commas
uploadExecArgs.push('-f', f);
}
});
}
if (flags) {
flags.split(',').map((f) => f.trim()).forEach((f) => {
uploadExecArgs.push('-F', `${f}`);
flags
.split(',')
.map((f) => f.trim())
.forEach((f) => {
uploadExecArgs.push('-F', f);
});
}
uploadExecArgs.push('--git-service', `${gitService}`);
uploadExecArgs.push('--git-service', gitService);
if (handleNoReportsFound) {
uploadExecArgs.push('--handle-no-reports-found');
}
if (jobCode) {
uploadExecArgs.push('--job-code', `${jobCode}`);
uploadExecArgs.push('--job-code', jobCode);
}
if (name) {
uploadExecArgs.push('-n', `${name}`);
uploadExecArgs.push('-n', name);
}
if (networkFilter) {
uploadExecArgs.push('--network-filter', `${networkFilter}`);
uploadExecArgs.push('--network-filter', networkFilter);
}
if (networkPrefix) {
uploadExecArgs.push('--network-prefix', `${networkPrefix}`);
uploadExecArgs.push('--network-prefix', networkPrefix);
}
if (overrideBranch) {
uploadExecArgs.push('-B', `${overrideBranch}`);
uploadExecArgs.push('-B', overrideBranch);
}
if (overrideBuild) {
uploadExecArgs.push('-b', `${overrideBuild}`);
uploadExecArgs.push('-b', overrideBuild);
}
if (overrideBuildUrl) {
uploadExecArgs.push('--build-url', `${overrideBuildUrl}`);
uploadExecArgs.push('--build-url', overrideBuildUrl);
}
if (overrideCommit) {
uploadExecArgs.push('-C', `${overrideCommit}`);
uploadExecArgs.push('-C', overrideCommit);
}
else if (`${context.eventName}` == 'pull_request' ||
`${context.eventName}` == 'pull_request_target') {
uploadExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
else if (['pull_request', 'pull_request_target'].includes(context.eventName)) {
const payload = context.payload;
uploadExecArgs.push('-C', payload.pull_request.head.sha);
}
if (overridePr) {
uploadExecArgs.push('-P', `${overridePr}`);
uploadExecArgs.push('-P', overridePr);
}
else if (`${context.eventName}` == 'pull_request_target') {
uploadExecArgs.push('-P', `${context.payload.number}`);
else if (context.eventName == 'pull_request_target') {
const payload = context.payload;
uploadExecArgs.push('-P', payload.number.toString());
}
if (plugin) {
uploadExecArgs.push('--plugin', `${plugin}`);
uploadExecArgs.push('--plugin', plugin);
}
if (plugins) {
plugins.split(',').map((p) => p.trim()).forEach((p) => {
uploadExecArgs.push('--plugin', `${p}`);
plugins
.split(',')
.map((p) => p.trim())
.forEach((p) => {
uploadExecArgs.push('--plugin', p);
});
}
if (reportCode) {
uploadExecArgs.push('--report-code', `${reportCode}`);
uploadExecArgs.push('--report-code', reportCode);
}
if (rootDir) {
uploadExecArgs.push('--network-root-folder', `${rootDir}`);
uploadExecArgs.push('--network-root-folder', rootDir);
}
if (searchDir) {
uploadExecArgs.push('-s', `${searchDir}`);
uploadExecArgs.push('-s', searchDir);
}
if (slug) {
uploadExecArgs.push('-r', `${slug}`);
uploadExecArgs.push('-r', slug);
}
if (workingDir) {
uploadOptions.cwd = workingDir;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

232
package-lock.json generated
View file

@ -15,16 +15,17 @@
"undici": "5.28.4"
},
"devDependencies": {
"@octokit/webhooks-types": "^7.5.1",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0",
"eslint-config-google": "^0.14.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"ts-jest": "^29.2.3",
"typescript": "^5.5.3"
"ts-jest": "^29.2.4",
"typescript": "^5.5.4"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@ -1432,6 +1433,12 @@
"@octokit/openapi-types": "^19.0.0"
}
},
"node_modules/@octokit/webhooks-types": {
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.5.1.tgz",
"integrity": "sha512-1dozxWEP8lKGbtEu7HkRbK1F/nIPuJXNfT0gd96y6d3LcHZTtRtlf8xz3nicSJfesADxJyDh+mWBOsdLkqgzYw==",
"dev": true
},
"node_modules/@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@ -1604,15 +1611,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "7.16.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.16.1.tgz",
"integrity": "sha512-u+1Qx86jfGQ5i4JjK33/FnawZRpsLxRnKzGE6EABZ40KxVT/vWsiZFEBBHjFOljmmV3MBYOHEKi0Jm9hbAOClA==",
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz",
"integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "7.16.1",
"@typescript-eslint/types": "7.16.1",
"@typescript-eslint/typescript-estree": "7.16.1",
"@typescript-eslint/visitor-keys": "7.16.1",
"@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/typescript-estree": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4"
},
"engines": {
@ -1631,6 +1638,105 @@
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz",
"integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz",
"integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==",
"dev": true,
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz",
"integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^1.3.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz",
"integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"eslint-visitor-keys": "^3.4.3"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/@typescript-eslint/parser/node_modules/minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "7.16.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.16.1.tgz",
@ -4834,9 +4940,9 @@
}
},
"node_modules/ts-jest": {
"version": "29.2.3",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.3.tgz",
"integrity": "sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==",
"version": "29.2.4",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.4.tgz",
"integrity": "sha512-3d6tgDyhCI29HlpwIq87sNuI+3Q6GLTTCeYRHCs7vDz+/3GCMwEtV9jezLyl4ZtnBgx00I7hm8PCP8cTksMGrw==",
"dev": true,
"dependencies": {
"bs-logger": "0.x",
@ -4923,9 +5029,9 @@
}
},
"node_modules/typescript": {
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
"integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
"version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@ -6226,6 +6332,12 @@
"@octokit/openapi-types": "^19.0.0"
}
},
"@octokit/webhooks-types": {
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-7.5.1.tgz",
"integrity": "sha512-1dozxWEP8lKGbtEu7HkRbK1F/nIPuJXNfT0gd96y6d3LcHZTtRtlf8xz3nicSJfesADxJyDh+mWBOsdLkqgzYw==",
"dev": true
},
"@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@ -6382,16 +6494,78 @@
}
},
"@typescript-eslint/parser": {
"version": "7.16.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.16.1.tgz",
"integrity": "sha512-u+1Qx86jfGQ5i4JjK33/FnawZRpsLxRnKzGE6EABZ40KxVT/vWsiZFEBBHjFOljmmV3MBYOHEKi0Jm9hbAOClA==",
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz",
"integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "7.16.1",
"@typescript-eslint/types": "7.16.1",
"@typescript-eslint/typescript-estree": "7.16.1",
"@typescript-eslint/visitor-keys": "7.16.1",
"@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/typescript-estree": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz",
"integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0"
}
},
"@typescript-eslint/types": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz",
"integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz",
"integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^1.3.0"
}
},
"@typescript-eslint/visitor-keys": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz",
"integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==",
"dev": true,
"requires": {
"@typescript-eslint/types": "7.18.0",
"eslint-visitor-keys": "^3.4.3"
}
},
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0"
}
},
"minimatch": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"requires": {
"brace-expansion": "^2.0.1"
}
}
}
},
"@typescript-eslint/scope-manager": {
@ -8717,9 +8891,9 @@
"requires": {}
},
"ts-jest": {
"version": "29.2.3",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.3.tgz",
"integrity": "sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==",
"version": "29.2.4",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.4.tgz",
"integrity": "sha512-3d6tgDyhCI29HlpwIq87sNuI+3Q6GLTTCeYRHCs7vDz+/3GCMwEtV9jezLyl4ZtnBgx00I7hm8PCP8cTksMGrw==",
"dev": true,
"requires": {
"bs-logger": "0.x",
@ -8760,9 +8934,9 @@
"dev": true
},
"typescript": {
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz",
"integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==",
"version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true
},
"undici": {

View file

@ -29,15 +29,16 @@
"undici": "5.28.4"
},
"devDependencies": {
"@octokit/webhooks-types": "^7.5.1",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0",
"eslint-config-google": "^0.14.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"ts-jest": "^29.2.3",
"typescript": "^5.5.3"
"ts-jest": "^29.2.4",
"typescript": "^5.5.4"
}
}

View file

@ -2,6 +2,7 @@
import * as core from '@actions/core';
import * as github from '@actions/github';
import {type PullRequestEvent} from '@octokit/webhooks-types';
import {setFailure} from './helpers';
@ -31,10 +32,7 @@ const getGitService = (): string => {
const isPullRequestFromFork = (): boolean => {
core.info(`evenName: ${context.eventName}`);
if (
`${context.eventName}` !== 'pull_request' &&
`${context.eventName}` !== 'pull_request_target'
) {
if (!['pull_request', 'pull_request_target'].includes(context.eventName)) {
return false;
}
@ -42,7 +40,7 @@ const isPullRequestFromFork = (): boolean => {
const headLabel = context.payload.pull_request.head.label;
core.info(`baseRef: ${baseLabel} | headRef: ${headLabel}`);
return (baseLabel.split(':')[0] !== headLabel.split(':')[0]);
return baseLabel.split(':')[0] !== headLabel.split(':')[0];
};
const getToken = async (): Promise<string> => {
@ -93,7 +91,7 @@ const buildCommitExec = async (): Promise<{
const workingDir = core.getInput('working-directory');
const commitCommand = 'create-commit';
const commitExecArgs = [];
const commitExecArgs: string[] = [];
const commitOptions: any = {};
commitOptions.env = Object.assign(process.env, {
@ -105,35 +103,33 @@ const buildCommitExec = async (): Promise<{
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || '',
});
if (token) {
commitOptions.env.CODECOV_TOKEN = token;
}
if (commitParent) {
commitExecArgs.push('--parent-sha', `${commitParent}`);
commitExecArgs.push('--parent-sha', commitParent);
}
commitExecArgs.push('--git-service', `${gitService}`);
commitExecArgs.push('--git-service', gitService);
if (overrideBranch) {
commitExecArgs.push('-B', `${overrideBranch}`);
commitExecArgs.push('-B', overrideBranch);
}
if (overrideCommit) {
commitExecArgs.push('-C', `${overrideCommit}`);
commitExecArgs.push('-C', overrideCommit);
} else if (
`${context.eventName}` == 'pull_request' ||
`${context.eventName}` == 'pull_request_target'
['pull_request', 'pull_request_target'].includes(context.eventName)
) {
commitExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
const payload = context.payload as PullRequestEvent;
commitExecArgs.push('-C', payload.pull_request.head.sha);
}
if (overridePr) {
commitExecArgs.push('--pr', `${overridePr}`);
} else if (
`${context.eventName}` == 'pull_request_target'
) {
commitExecArgs.push('--pr', `${context.payload.number}`);
commitExecArgs.push('--pr', overridePr);
} else if (context.eventName === 'pull_request_target') {
const payload = context.payload as PullRequestEvent;
commitExecArgs.push('--pr', payload.number.toString());
}
if (slug) {
commitExecArgs.push('--slug', `${slug}`);
commitExecArgs.push('--slug', slug);
}
if (failCi) {
commitExecArgs.push('-Z');
@ -142,7 +138,6 @@ const buildCommitExec = async (): Promise<{
commitOptions.cwd = workingDir;
}
return {commitExecArgs, commitOptions, commitCommand};
};
@ -156,10 +151,10 @@ const buildGeneralExec = (): {
const args = [];
if (codecovYmlPath) {
args.push('--codecov-yml-path', `${codecovYmlPath}`);
args.push('--codecov-yml-path', codecovYmlPath);
}
if (url) {
args.push('--enterprise-url', `${url}`);
args.push('--enterprise-url', url);
}
if (verbose) {
args.push('-v');
@ -180,9 +175,8 @@ const buildReportExec = async (): Promise<{
const failCi = isTrue(core.getInput('fail_ci_if_error'));
const workingDir = core.getInput('working-directory');
const reportCommand = 'create-report';
const reportExecArgs = [];
const reportExecArgs: string[] = [];
const reportOptions: any = {};
reportOptions.env = Object.assign(process.env, {
@ -194,29 +188,27 @@ const buildReportExec = async (): Promise<{
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || '',
});
if (token) {
reportOptions.env.CODECOV_TOKEN = token;
}
reportExecArgs.push('--git-service', `${gitService}`);
reportExecArgs.push('--git-service', gitService);
if (overrideCommit) {
reportExecArgs.push('-C', `${overrideCommit}`);
reportExecArgs.push('-C', overrideCommit);
} else if (
`${context.eventName}` == 'pull_request' ||
`${context.eventName}` == 'pull_request_target'
['pull_request', 'pull_request_target'].includes(context.eventName)
) {
reportExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
const payload = context.payload as PullRequestEvent;
reportExecArgs.push('-C', payload.pull_request.head.sha);
}
if (overridePr) {
reportExecArgs.push('-P', `${overridePr}`);
} else if (
`${context.eventName}` == 'pull_request_target'
) {
reportExecArgs.push('-P', `${context.payload.number}`);
reportExecArgs.push('-P', overridePr);
} else if (context.eventName == 'pull_request_target') {
const payload = context.payload as PullRequestEvent;
reportExecArgs.push('-P', payload.number.toString());
}
if (slug) {
reportExecArgs.push('--slug', `${slug}`);
reportExecArgs.push('--slug', slug);
}
if (failCi) {
reportExecArgs.push('-Z');
@ -272,7 +264,7 @@ const buildUploadExec = async (): Promise<{
);
const workingDir = core.getInput('working-directory');
const uploadExecArgs = [];
const uploadExecArgs: string[] = [];
const uploadCommand = 'do-upload';
const uploadOptions: any = {};
uploadOptions.env = Object.assign(process.env, {
@ -308,85 +300,94 @@ const buildUploadExec = async (): Promise<{
uploadExecArgs.push('-e', envVarsArg.join(','));
}
if (exclude) {
uploadExecArgs.push('--exclude', `${exclude}`);
uploadExecArgs.push('--exclude', exclude);
}
if (failCi) {
uploadExecArgs.push('-Z');
}
if (file) {
uploadExecArgs.push('-f', `${file}`);
uploadExecArgs.push('-f', file);
}
if (files) {
files.split(',').map((f) => f.trim()).forEach((f) => {
if (f.length > 0) { // this handles trailing commas
uploadExecArgs.push('-f', `${f}`);
}
});
files
.split(',')
.map((f) => f.trim())
.forEach((f) => {
if (f.length > 0) {
// this handles trailing commas
uploadExecArgs.push('-f', f);
}
});
}
if (flags) {
flags.split(',').map((f) => f.trim()).forEach((f) => {
uploadExecArgs.push('-F', `${f}`);
});
flags
.split(',')
.map((f) => f.trim())
.forEach((f) => {
uploadExecArgs.push('-F', f);
});
}
uploadExecArgs.push('--git-service', `${gitService}`);
uploadExecArgs.push('--git-service', gitService);
if (handleNoReportsFound) {
uploadExecArgs.push('--handle-no-reports-found');
}
if (jobCode) {
uploadExecArgs.push('--job-code', `${jobCode}`);
uploadExecArgs.push('--job-code', jobCode);
}
if (name) {
uploadExecArgs.push('-n', `${name}`);
uploadExecArgs.push('-n', name);
}
if (networkFilter) {
uploadExecArgs.push('--network-filter', `${networkFilter}`);
uploadExecArgs.push('--network-filter', networkFilter);
}
if (networkPrefix) {
uploadExecArgs.push('--network-prefix', `${networkPrefix}`);
uploadExecArgs.push('--network-prefix', networkPrefix);
}
if (overrideBranch) {
uploadExecArgs.push('-B', `${overrideBranch}`);
uploadExecArgs.push('-B', overrideBranch);
}
if (overrideBuild) {
uploadExecArgs.push('-b', `${overrideBuild}`);
uploadExecArgs.push('-b', overrideBuild);
}
if (overrideBuildUrl) {
uploadExecArgs.push('--build-url', `${overrideBuildUrl}`);
uploadExecArgs.push('--build-url', overrideBuildUrl);
}
if (overrideCommit) {
uploadExecArgs.push('-C', `${overrideCommit}`);
uploadExecArgs.push('-C', overrideCommit);
} else if (
`${context.eventName}` == 'pull_request' ||
`${context.eventName}` == 'pull_request_target'
['pull_request', 'pull_request_target'].includes(context.eventName)
) {
uploadExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
const payload = context.payload as PullRequestEvent;
uploadExecArgs.push('-C', payload.pull_request.head.sha);
}
if (overridePr) {
uploadExecArgs.push('-P', `${overridePr}`);
} else if (
`${context.eventName}` == 'pull_request_target'
) {
uploadExecArgs.push('-P', `${context.payload.number}`);
uploadExecArgs.push('-P', overridePr);
} else if (context.eventName == 'pull_request_target') {
const payload = context.payload as PullRequestEvent;
uploadExecArgs.push('-P', payload.number.toString());
}
if (plugin) {
uploadExecArgs.push('--plugin', `${plugin}`);
uploadExecArgs.push('--plugin', plugin);
}
if (plugins) {
plugins.split(',').map((p) => p.trim()).forEach((p) => {
uploadExecArgs.push('--plugin', `${p}`);
});
plugins
.split(',')
.map((p) => p.trim())
.forEach((p) => {
uploadExecArgs.push('--plugin', p);
});
}
if (reportCode) {
uploadExecArgs.push('--report-code', `${reportCode}`);
uploadExecArgs.push('--report-code', reportCode);
}
if (rootDir) {
uploadExecArgs.push('--network-root-folder', `${rootDir}`);
uploadExecArgs.push('--network-root-folder', rootDir);
}
if (searchDir) {
uploadExecArgs.push('-s', `${searchDir}`);
uploadExecArgs.push('-s', searchDir);
}
if (slug) {
uploadExecArgs.push('-r', `${slug}`);
uploadExecArgs.push('-r', slug);
}
if (workingDir) {
uploadOptions.cwd = workingDir;