Skip to content
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

Allow constraining linter versions in GitHub Action configuration #349

Merged
merged 2 commits into from
Mar 31, 2022

Conversation

akaihola
Copy link
Owner

@akaihola akaihola commented Mar 30, 2022

Fixes #337. Being tested in akaihola/pgtricks#18.

Linter support was added in #313.

@akaihola akaihola added enhancement New feature or request CI labels Mar 30, 2022
@akaihola akaihola added this to the 1.5.0 milestone Mar 30, 2022
@akaihola akaihola requested a review from roniemartinez March 30, 2022 19:25
@akaihola akaihola self-assigned this Mar 30, 2022
@akaihola akaihola force-pushed the gh-action-linter-versions branch from 23b703a to 064c1bf Compare March 30, 2022 19:42
akaihola added a commit to akaihola/pgtricks that referenced this pull request Mar 30, 2022
@akaihola
Copy link
Owner Author

The workflow in akaihola/pgtricks#18 seems to work. I have this in .github/workflows/python-package.yml:

    - uses: akaihola/darker@gh-action-linter-versions
      with:
        options: --verbose --check --diff --isort
        revision: origin/master...
        lint: flake8 == 4.0.0 , pylint==2.13.2

The versions for flake8 and pylint are one patch version older than the newest releases. And sure enough, I see this in the log for the workflow:

Successfully installed astroid-2.11.2 black-22.3.0 click-8.1.0 darker-1.4.2 dill-0.3.4 flake8-4.0.0
isort-5.10.1 lazy-object-proxy-1.7.1 mccabe-0.6.1 mypy-extensions-0.4.3 pathspec-0.9.0 platformdirs-2.5.1
pycodestyle-2.8.0 pyflakes-2.4.0 pylint-2.13.2 toml-0.10.2 tomli-2.0.1 wrapt-1.14.0

So flake8==4.0.0 and pylint==2.13.2 were indeed installed.

Note that the workflow fails on purpose – I added extra spaces so reformatters and linters would fail and show the log.

Copy link
Collaborator

@roniemartinez roniemartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🚀

@akaihola akaihola merged commit 3fa00ac into master Mar 31, 2022
@akaihola akaihola deleted the gh-action-linter-versions branch March 31, 2022 16:45
akaihola added a commit to akaihola/pgtricks that referenced this pull request Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Allow pinning linter packages in the GitHub Action
2 participants