How to set up actions in GitHub for new user?

不想你离开。 提交于 2021-02-08 08:32:15

问题


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


回答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


来源:https://stackoverflow.com/questions/62271879/how-to-set-up-actions-in-github-for-new-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!