Skip to content

Commit

Permalink
Working directory (#40)
Browse files Browse the repository at this point in the history
* Added working_directory option
  • Loading branch information
hawkeyexl authored Oct 18, 2024
1 parent 6419692 commit 96cbbd7
Show file tree
Hide file tree
Showing 8 changed files with 856 additions and 1,399 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ on:
description: runner
required: true
default: ubuntu-latest
version:
description: version
working_directory:
description: working_directory
required: false
default: latest
command:
description: command
required: false
Expand All @@ -26,7 +25,7 @@ on:
create_pr_on_change:
description: create_pr_on_change
required: false
default: 'true'
default: 'false'
pr_body:
description: pr_body
required: false
Expand Down Expand Up @@ -64,12 +63,11 @@ jobs:
uses: ./ # Uses an action in the root directory
id: dd
with:
version: ${{ github.event.inputs.version }}
working_directory: ${{ github.event.inputs.working_directory }}
command: ${{ github.event.inputs.command }}
config: ${{ github.event.inputs.config }}
input: ${{ github.event.inputs.input }}
create_pr_on_change: ${{ github.event.inputs.create_pr_on_change }}
exit_on_fail: ${{ github.event.inputs.exit_on_fail }}
create_issue_on_fail: ${{ github.event.inputs.create_issue_on_fail }}
issue_title: ${{ github.event.inputs.issue_title }}
issue_body: ${{ github.event.inputs.issue_body }}
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,6 @@ The action outputs the results of the command as a JSON-formatted string that yo

**Note:** On Ubuntu, this action only supports headless mode. Firefox and Chrome contexts automatically fall back to headless mode when necessary. If your tests doesn't work in headless mode (like if you need the 'startRecording' action), use macOS or Windows.

## File structure

This action runs in the current working directory of the workflow. If you want to change the directory, you can do so by adding a `working-directory` key to the `github-action` step:

```yaml
- uses: doc-detective/github-action@v1
working-directory: path/to/your/directory
```

Just like the main project, this action looks for a `.doc-detective.json` file in the current directory for the configuration if it isn't specified in the `config` input.

All paths are relative to the current working directory.

## Inputs

You can customize the action with the following optional inputs.
Expand All @@ -57,6 +44,16 @@ Specify the version of Doc Detective to use. This can be a specific version numb
version: 2.15.0
```

### `working_directory` (default: Repository root)

The working directory for the action, relative to the root of the repository. This is where the action looks for the configuration file and where it runs the command.

```yaml
- uses: doc-detective/github-action@v1
with:
working_directory: path/to/your/directory
```

### `command` (default: `runTests`)

The command to run. Valid values are "runTests" and "runCoverage".
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: The command to run. Valid values are "runTests" and "runCoverage".
required: true
default: runTests
working_directory:
description: The directory to run the command in, relative to the root of the repository. Defaults to the root of the repository.
required: false
default: "."
config:
description: Path to the configuration file.
required: false
Expand Down
Loading

0 comments on commit 96cbbd7

Please sign in to comment.