1

I just got a GitHub account and writing small scripts in Python which I am learning.

While adding my code to GitHub I noticed there is an option to run tests/validation on my code but mine is empty.

I googled around and found that lint and black and are good checks.

I found this Action that I want to add - https://github.com/marketplace/actions/python-quality-and-format-checker

There is a "script" and a "config" that I think I need to add/update somewhere. Also when I click "Use latest version" it tells me to add the code into some .yml.

Can anyone assist me in installing this Action or point me in the right direction? Also, how can I use this Action on all my repositories/code?

=======================================

EDIT:

This link has the instructions - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow

place yaml or yml in this directory -> .github/workflows

For this Action: https://github.com/marketplace/actions/python-quality-and-format-checker

the code inside the file will look like this:

on: [push, pull_request]
name: Python Linting
jobs:
  PythonLinting:
    name: Python linting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Konstruktoid Python linting
        uses: konstruktoid/action-pylint@master

thanks to: bertrand martel

trustory
  • 215
  • 3
  • 13
  • 1
    see https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow – Bertrand Martel Jun 08 '20 at 22:59
  • Hey, so the lint and black action has 2 sections. Does the first one go in the workflows folder and the second one goes in the actions folder? Also what is the code under "Script"? – trustory Jun 08 '20 at 23:45
  • 1
    I think you only care about the first section, the one in yaml. The script file is just the entrypoint, it's the script that is executed when the step starts. You don't need to create the script because it's already in the docker image of the actions. But if you need to update the script it's possible to update the entrypoint by updating the yaml file and setting `entrypoint: /path/to/your/custom/script` – Bertrand Martel Jun 08 '20 at 23:51
  • just to be sure I only need to first part that starts with on: and ends with uses:...and the file should be under .github/workflows/name.yml ........ What is this part of the code used for? workflow "Python Linting" { on = "push" resolves = ["python-linting"] } action "python-linting" { uses = "konstruktoid/action-pylint@master" } – trustory Jun 09 '20 at 00:16
  • 1
    it was the old workflow format, it's not used anymore – Bertrand Martel Jun 09 '20 at 00:53
  • ok thank you very much! – trustory Jun 09 '20 at 02:55

1 Answers1

1

pylint is part of the new GitHub Super Linter (github/super-linter):

Introducing GitHub Super Linter: one linter to rule them all

The Super Linter is a source code repository that is packaged into a Docker container and called by GitHub Actions. This allows for any repository on GitHub.com to call the Super Linter and start utilizing its benefits.

When you’ve set your repository to start running this action, any time you open a pull request, it will start linting the code case and return via the Status API.
It will let you know if any of your code changes passed successfully, or if any errors were detected, where they are, and what they are.

This then allows the developer to go back to their branch, fix any issues, and create a new push to the open pull request.
At that point, the Super Linter will run again and validate the updated code and repeat the process.

And you can set it up to only int new files if you want.


Update August 2020:

github/super-linter issue 226 has been closed with PR 593:

This Pr will add:

  • Black python linting
  • Updated tests
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250