From d8109ec07ec3d6ebb6f57ecd030f60c0d63995ec Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 8 Jun 2022 13:08:43 -0400 Subject: [PATCH] Added an example actions.yml file --- README.md | 3 +++ examples/actions-only_changed_files.yml | 26 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 examples/actions-only_changed_files.yml diff --git a/README.md b/README.md index a40bf74..f1b3a49 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/examples/actions-only_changed_files.yml b/examples/actions-only_changed_files.yml new file mode 100644 index 0000000..02209e4 --- /dev/null +++ b/examples/actions-only_changed_files.yml @@ -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