mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-14 15:07:25 +00:00
feat: add useCwd option
This commit adds the useCwd uploader option to the action. Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
This commit is contained in:
parent
bbeaa14035
commit
90a6d0bb23
5 changed files with 23991 additions and 935 deletions
|
|
@ -56,6 +56,9 @@ inputs:
|
||||||
slug:
|
slug:
|
||||||
description: 'Specify the slug manually (Enterprise use)'
|
description: 'Specify the slug manually (Enterprise use)'
|
||||||
required: false
|
required: false
|
||||||
|
useCwd:
|
||||||
|
description: 'Use the current working directory instead of the git root'
|
||||||
|
required: false
|
||||||
verbose:
|
verbose:
|
||||||
description: 'Specify whether the Codecov output should be verbose'
|
description: 'Specify whether the Codecov output should be verbose'
|
||||||
required: false
|
required: false
|
||||||
|
|
|
||||||
24905
dist/index.js
vendored
24905
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -69,6 +69,7 @@ test('upload args', () => {
|
||||||
'working-directory': 'src',
|
'working-directory': 'src',
|
||||||
'plugin': 'xcode',
|
'plugin': 'xcode',
|
||||||
'exclude': 'src',
|
'exclude': 'src',
|
||||||
|
'useCwd': 'true',
|
||||||
};
|
};
|
||||||
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];
|
||||||
|
|
@ -114,6 +115,7 @@ test('upload args', () => {
|
||||||
'xcode',
|
'xcode',
|
||||||
'--exclude',
|
'--exclude',
|
||||||
'src',
|
'src',
|
||||||
|
'--useCwd',
|
||||||
];
|
];
|
||||||
|
|
||||||
expect(uploadExecArgs).toEqual(expectedArgs);
|
expect(uploadExecArgs).toEqual(expectedArgs);
|
||||||
|
|
@ -157,7 +159,7 @@ 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[] = [];
|
||||||
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}`);
|
||||||
}
|
}
|
||||||
|
|
@ -207,7 +209,7 @@ test('commit args', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('commit args using context', () => {
|
test('commit args using context', () => {
|
||||||
const expectedArgs :string[] = [];
|
const expectedArgs: string[] = [];
|
||||||
|
|
||||||
const {commitExecArgs, commitCommand} = buildCommitExec();
|
const {commitExecArgs, commitCommand} = buildCommitExec();
|
||||||
if (context.eventName == 'pull_request') {
|
if (context.eventName == 'pull_request') {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const buildCommitExec = () => {
|
||||||
const commitCommand = 'create-commit';
|
const commitCommand = 'create-commit';
|
||||||
const commitExecArgs = [];
|
const commitExecArgs = [];
|
||||||
|
|
||||||
const commitOptions:any = {};
|
const commitOptions: any = {};
|
||||||
commitOptions.env = Object.assign(process.env, {
|
commitOptions.env = Object.assign(process.env, {
|
||||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||||
|
|
@ -97,7 +97,7 @@ const buildReportExec = () => {
|
||||||
const reportCommand = 'create-report';
|
const reportCommand = 'create-report';
|
||||||
const reportExecArgs = [];
|
const reportExecArgs = [];
|
||||||
|
|
||||||
const reportOptions:any = {};
|
const reportOptions: any = {};
|
||||||
reportOptions.env = Object.assign(process.env, {
|
reportOptions.env = Object.assign(process.env, {
|
||||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||||
|
|
@ -148,10 +148,11 @@ const buildUploadExec = () => {
|
||||||
const workingDir = core.getInput('working-directory');
|
const workingDir = core.getInput('working-directory');
|
||||||
const plugin = core.getInput('plugin');
|
const plugin = core.getInput('plugin');
|
||||||
const exclude = core.getInput('exclude');
|
const exclude = core.getInput('exclude');
|
||||||
|
const useCwd = isTrue(core.getInput('useCwd'));
|
||||||
|
|
||||||
const uploadExecArgs = [];
|
const uploadExecArgs = [];
|
||||||
const uploadCommand = 'do-upload';
|
const uploadCommand = 'do-upload';
|
||||||
const uploadOptions:any = {};
|
const uploadOptions: any = {};
|
||||||
uploadOptions.env = Object.assign(process.env, {
|
uploadOptions.env = Object.assign(process.env, {
|
||||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||||
|
|
@ -244,6 +245,9 @@ const buildUploadExec = () => {
|
||||||
if (exclude) {
|
if (exclude) {
|
||||||
uploadExecArgs.push('--exclude', `${exclude}`);
|
uploadExecArgs.push('--exclude', `${exclude}`);
|
||||||
}
|
}
|
||||||
|
if (useCwd) {
|
||||||
|
uploadExecArgs.push('--useCwd');
|
||||||
|
}
|
||||||
|
|
||||||
if (uploaderVersion == '') {
|
if (uploaderVersion == '') {
|
||||||
uploaderVersion = 'latest';
|
uploaderVersion = 'latest';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue