Skip to content

Added an example actions.yml file #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ steps:
python-version: "3.7"
```

### Examples
* [Only lint changed files, and ignore missing docstrings](examples/actions-only_changed_files.yml)

## Details

Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since
Expand Down
26 changes: 26 additions & 0 deletions examples/actions-only_changed_files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint only files changed in Pull Request, and ignore Missing docstrings
on:
pull_request:
types: [ opened, reopened, synchronize, edited ]
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # This is necessary to get the commits
- name: Set up Python environment
uses: actions/setup-python@v3
with:
python-version: "3.8"
- name: Get changed python files between base and head
run: >
echo "CHANGED_FILES=$(echo $(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- | grep \.py))" >> $GITHUB_ENV
- if: ${{ env.CHANGED_FILES }}
uses: marian-code/python-lint-annotate@v3
with:
python-root-list: ${{ env.CHANGED_FILES }}
extra-pylint-options: "--disable=C0114,C0116" # Missing doctrings
extra-pydocstyle-options: "--ignore=D1" # Missing doctrings http://www.pydocstyle.org/en/stable/error_codes.html#grouping