diff --git a/README.md b/README.md index 25167c1..7e0a80a 100644 --- a/README.md +++ b/README.md @@ -29,14 +29,15 @@ jobs: ## Inputs -| Name | Description | Required | default | -| -------------- | ----------------------------------------------------------------- | -------- | ------- | -| token | Token used for pushing fixes and commenting on PRs. | true | | -| run-tests | Whether tests should be run. | false | true | -| run-analysis | Whether static analysis should be run. | false | true | -| run-coverage | Whether code coverage should be run. | false | true | -| run-behind-by | Whether action should check if HEAD branch is behind base branch. | false | true | -| create-comment | Whether the action should comment the output status. | false | true | +| Name | Description | Required | Default | +| ----------------- | ----------------------------------------------------------------- | -------- | ------- | +| token | Token used for pushing fixes and commenting on PRs. | true | | +| run-tests | Whether tests should be run. | false | true | +| run-analysis | Whether static analysis should be run. | false | true | +| run-coverage | Whether code coverage should be run. | false | true | +| run-behind-by | Whether action should check if HEAD branch is behind base branch. | false | true | +| create-comment | Whether the action should comment the output status. | false | true | +| working-directory | Working directory to run the action in | false | "." | ## Contributing diff --git a/action.yml b/action.yml index c03f450..c55f688 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,11 @@ inputs: description: "Token used for pushing fixes and commenting on PRs" required: true + working-directory: + description: "The working directory" + required: false + default: "." + run-tests: description: "Run tests" required: false diff --git a/dist/index.js b/dist/index.js index 522f0e5..af29b59 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33152,6 +33152,11 @@ const behind_1 = __nccwpck_require__(8890); const push_1 = __nccwpck_require__(3662); const run = async () => { try { + const workingDirectory = (0, core_1.getInput)('working-directory'); + // Check if the working directory is different from the current directory + if (workingDirectory && workingDirectory !== process.cwd()) { + process.chdir(workingDirectory); + } const token = process.env.GITHUB_TOKEN || (0, core_1.getInput)("token"); const runTests = (0, core_1.getBooleanInput)("run-tests"); const runAnalyze = (0, core_1.getBooleanInput)("run-analyze"); diff --git a/src/main.ts b/src/main.ts index 95c1590..0d5c6d2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,6 +13,12 @@ export type stepResponse = { output: string; error: boolean }; const run = async () => { try { + const workingDirectory = getInput('working-directory'); + // Check if the working directory is different from the current directory + if (workingDirectory && workingDirectory !== process.cwd()) { + process.chdir(workingDirectory); + } + const token = process.env.GITHUB_TOKEN || getInput("token"); const runTests = getBooleanInput("run-tests"); const runAnalyze = getBooleanInput("run-analyze"); diff --git a/tests/pass_repo/coverage/lcov.info b/tests/pass_repo/coverage/lcov.info new file mode 100644 index 0000000..9c31854 --- /dev/null +++ b/tests/pass_repo/coverage/lcov.info @@ -0,0 +1,16 @@ +SF:lib/main.dart +DA:3,0 +DA:8,2 +DA:10,1 +DA:17,1 +DA:21,1 +DA:22,1 +DA:28,0 +DA:30,1 +DA:32,1 +DA:33,4 +DA:34,1 +DA:35,1 +LF:12 +LH:10 +end_of_record