Skip to content

Commit

Permalink
Merge pull request #8 from ingomueller-net/working-dir
Browse files Browse the repository at this point in the history
feat: cd to workspace folder before executing yapf
  • Loading branch information
AlexanderMelde authored Nov 26, 2024
2 parents c1a25f7 + a786fe7 commit 88aa9b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ jobs:

You can pass any other [YAPF parameter](https://github.com/google/yapf#usage) using the `args` setting, e.g. for setting a different code style (default is PEP8), but you can also remove the `with` section entirely if you wish.

If you want to exclude a certain directory, you can use the args field like this: `args: --verbose --exclude '**/tests/**'`. Thank you [@pksol](https://github.com/pksol) for the [example](https://github.com/AlexanderMelde/yapf-action/issues/1).
If you want to exclude a certain file or directory, you can either use the `--exclude` parameter or a `.yapfignore` file.

### Migration Notice
Earlier versions of this action did not set the working directory before executing `yapf`.

If you used the `--exclude '**/tests/**'` workaround, you might need to simplify this to `--exclude 'tests/**'` now.
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e
echo "Checking formatting for $GITHUB_REPOSITORY"
sh -c "yapf --diff --recursive $GITHUB_WORKSPACE $*"
cd "$GITHUB_WORKSPACE"
sh -c "yapf --diff --recursive . $*"

0 comments on commit 88aa9b9

Please sign in to comment.