mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-09 20:47:26 +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:
|
||||
description: 'Specify the slug manually (Enterprise use)'
|
||||
required: false
|
||||
useCwd:
|
||||
description: 'Use the current working directory instead of the git root'
|
||||
required: false
|
||||
verbose:
|
||||
description: 'Specify whether the Codecov output should be verbose'
|
||||
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',
|
||||
'plugin': 'xcode',
|
||||
'exclude': 'src',
|
||||
'useCwd': 'true',
|
||||
};
|
||||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
|
|
@ -114,6 +115,7 @@ test('upload args', () => {
|
|||
'xcode',
|
||||
'--exclude',
|
||||
'src',
|
||||
'--useCwd',
|
||||
];
|
||||
|
||||
expect(uploadExecArgs).toEqual(expectedArgs);
|
||||
|
|
@ -157,7 +159,7 @@ test('report args using context', () => {
|
|||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
}
|
||||
const expectedArgs : string[] = [];
|
||||
const expectedArgs: string[] = [];
|
||||
if (context.eventName == 'pull_request') {
|
||||
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
|
|
@ -207,7 +209,7 @@ test('commit args', () => {
|
|||
});
|
||||
|
||||
test('commit args using context', () => {
|
||||
const expectedArgs :string[] = [];
|
||||
const expectedArgs: string[] = [];
|
||||
|
||||
const {commitExecArgs, commitCommand} = buildCommitExec();
|
||||
if (context.eventName == 'pull_request') {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ const buildCommitExec = () => {
|
|||
const commitCommand = 'create-commit';
|
||||
const commitExecArgs = [];
|
||||
|
||||
const commitOptions:any = {};
|
||||
const commitOptions: any = {};
|
||||
commitOptions.env = Object.assign(process.env, {
|
||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||
|
|
@ -97,7 +97,7 @@ const buildReportExec = () => {
|
|||
const reportCommand = 'create-report';
|
||||
const reportExecArgs = [];
|
||||
|
||||
const reportOptions:any = {};
|
||||
const reportOptions: any = {};
|
||||
reportOptions.env = Object.assign(process.env, {
|
||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||
|
|
@ -148,10 +148,11 @@ const buildUploadExec = () => {
|
|||
const workingDir = core.getInput('working-directory');
|
||||
const plugin = core.getInput('plugin');
|
||||
const exclude = core.getInput('exclude');
|
||||
const useCwd = isTrue(core.getInput('useCwd'));
|
||||
|
||||
const uploadExecArgs = [];
|
||||
const uploadCommand = 'do-upload';
|
||||
const uploadOptions:any = {};
|
||||
const uploadOptions: any = {};
|
||||
uploadOptions.env = Object.assign(process.env, {
|
||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||
|
|
@ -244,6 +245,9 @@ const buildUploadExec = () => {
|
|||
if (exclude) {
|
||||
uploadExecArgs.push('--exclude', `${exclude}`);
|
||||
}
|
||||
if (useCwd) {
|
||||
uploadExecArgs.push('--useCwd');
|
||||
}
|
||||
|
||||
if (uploaderVersion == '') {
|
||||
uploaderVersion = 'latest';
|
||||
|
|
|
|||
Loading…
Reference in a new issue