Skip to content

Commit

Permalink
Allow specifying a working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
wjessop committed Sep 23, 2024
1 parent 6a9e59a commit 4dd2d7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ permissions:

- `ruby-version` - If your project has a `.ruby-version` file, this Action will use that version of Ruby. If not, this will be forwarded to the [ruby/setup-ruby](https://github.com/ruby/setup-ruby) action, so it takes the same values.
- `autofix` - If set to `false`, the action will not attempt to auto-fix any errors. Defaults to `true`.
- `workdir` - If set the action will descend to this directory before running `bundle exec standardrb …`. Defaults to `.`.

Example with options set:

Expand All @@ -62,6 +63,7 @@ Example with options set:
with:
ruby-version: '3.3'
autofix: false
workdir: my/app/subdirectory
```

## Screenshots
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ inputs:
description: 'Whether autofixes should be committed back to the branch'
required: false
default: 'true'
WORKDIR:
description: "The directory from which to run the standardrb command. Default '.'"
default: '.'

runs:
using: composite
Expand All @@ -19,6 +22,9 @@ runs:
- name: Checkout code
uses: actions/checkout@v4

- name: Change to the workdir
run: pushd ${{ inputs.workdir }}

- name: Check for .ruby-version file
id: use_ruby_version_or_default
shell: bash
Expand Down Expand Up @@ -66,6 +72,9 @@ runs:
git push
echo "::endgroup::"
- name: Change back to the root directory
run: popd

- name: Fail the build if Standard Ruby failed
shell: bash
if: ${{ steps.standardrb.outcome == 'failure' }}
Expand Down

0 comments on commit 4dd2d7e

Please sign in to comment.