diff --git a/.github/linters/.isort.cfg b/.github/linters/.isort.cfg new file mode 100644 index 0000000..f238bf7 --- /dev/null +++ b/.github/linters/.isort.cfg @@ -0,0 +1,2 @@ +[settings] +profile = black diff --git a/.github/linters/.mypy.ini b/.github/linters/.mypy.ini new file mode 100644 index 0000000..f0d4703 --- /dev/null +++ b/.github/linters/.mypy.ini @@ -0,0 +1,5 @@ +[mypy] +disable_error_code = attr-defined, import-not-found + +[mypy-github3.*] +ignore_missing_imports = True diff --git a/.github/linters/isort.cfg b/.github/linters/isort.cfg deleted file mode 100644 index 5d7bf33..0000000 --- a/.github/linters/isort.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[tool.isort] -profile = "black" diff --git a/Makefile b/Makefile index cbfa55f..69a9f60 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,11 @@ clean: .PHONY: lint lint: - pylint --rcfile=.github/linters/.python-lint --fail-under=9.0 *.py # stop the build if there are Python syntax errors or undefined names - flake8 . --config=.github/linters/.flake8 --count --select=E9,F63,F7,F82 --exclude .venv --show-source + flake8 . --config=.github/linters/.flake8 --count --select=E9,F63,F7,F82 --show-source # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --config=.github/linters/.flake8 --count --exclude .venv --exit-zero --max-complexity=10 --max-line-length=127 + flake8 . --config=.github/linters/.flake8 --count --exit-zero --max-complexity=15 --max-line-length=150 + isort --settings-file=.github/linters/.isort.cfg . + pylint --rcfile=.github/linters/.python-lint --fail-under=9.0 *.py + mypy --config-file=.github/linters/.mypy.ini *.py black . diff --git a/README.md b/README.md index 762e2b4..7348a6f 100644 --- a/README.md +++ b/README.md @@ -29,14 +29,30 @@ Note: Your GitHub token will need to have read access to all the repositories in Below are the allowed configuration options: +#### Authentication + +This action can be configured to authenticate with GitHub App Installation or Personal Access Token (PAT). If all configuration options are provided, the GitHub App Installation configuration has precedence. You can choose one of the following methods to authenticate: + +##### GitHub App Installation + +| field | required | default | description | +|-------------------------------|----------|---------|-------------| +| `GH_APP_ID` | True | `""` | GitHub Application ID. See [documentation](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/about-authentication-with-a-github-app) for more details. | +| `GH_APP_INSTALLATION_ID` | True | `""` | GitHub Application Installation ID. See [documentation](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/about-authentication-with-a-github-app) for more details. | +| `GH_APP_PRIVATE_KEY` | True | `""` | GitHub Application Private Key. See [documentation](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/about-authentication-with-a-github-app) for more details. | + +##### Personal Access Token (PAT) + +| field | required | default | description | +|-------------------------------|----------|---------|-------------| +| `GH_TOKEN` | True | `""` | The GitHub Token used to scan the repository. Must have read access to all repository you are interested in scanning. | + +#### Other Configuration Options + | field | required | default | description | |---------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `ACTIVITY_METHOD` | false | `"pushed"` | How to get the last active date of the repository. Defaults to `pushed`, which is the last time any branch had a push. Can also be set to `default_branch_updated` to instead measure from the latest commit on the default branch (good for filtering out dependabot ) | -| `GH_APP_ID` | false | `""` | GitHub Application ID. | -| `GH_APP_INSTALLATION_ID` | false | `""` | GitHub Application Installation ID. | -| `GH_APP_PRIVATE_KEY` | false | `""` | GitHub Application Private Key | | `GH_ENTERPRISE_URL` | false | `""` | URL of GitHub Enterprise instance to use for auth instead of github.com | -| `GH_TOKEN` | true | | The GitHub Token used to scan repositories. Must have read access to all repositories you are interested in scanning | | `INACTIVE_DAYS` | true | | The number of days used to determine if repository is stale, based on `push` events | | `EXEMPT_REPOS` | false | | Comma separated list of repositories to exempt from being flagged as stale. Supports Unix shell-style wildcards. ie. `EXEMPT_REPOS = "stale-repos,test-repo,conf-*"` | | `EXEMPT_TOPICS` | false | | Comma separated list of topics to exempt from being flagged as stale | diff --git a/requirements-test.txt b/requirements-test.txt index f3be524..793cc3e 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,5 +1,9 @@ black==24.3.0 flake8==7.0.0 +mypy==1.8.0 +mypy-extensions==1.0.0 pylint==3.1.0 pytest==8.1.1 pytest-cov==5.0.0 +types-python-dateutil==2.9.0.20240316 +types-requests==2.31.0.20240311