koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts
https://www.shellcheck.net
GNU General Public License v3.0
36.39k stars 1.78k forks source link

Should this project contain/support a GitHub Action for shellcheck? #1492

Closed cclauss closed 3 years ago

cclauss commented 5 years ago

Should this project contain the code for a simple yet flexible GitHub Action that allows repo maintainers to quickly add automated shellcheck testing on all pull requests submitted to their repos?

Putting that code into this repo or another koalaman repo will focus development efforts on a single, community-supported GitHub Action for shellcheck instead of a multitude of homegrown solutions.

Currently you must be in the GitHub Action beta to be able to use Actions.

https://github.com/marketplace/actions/haskell-linter

cclauss commented 5 years ago

https://github.com/actions/bin/tree/master/shellcheck

koalaman commented 5 years ago

I'm now on the beta waitlist. I don't know if or when I'll get approved, but I'll have a look then.

thomasleplus commented 3 years ago

Any update? I'd would really like to use an "official" shellcheck action. Thanks

cclauss commented 3 years ago

What is wrong with https://github.com/marketplace/actions/shellcheck ?

szepeviktor commented 3 years ago

Even GHA images include shellcheck by default - through APT packages: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md

evulhotdog commented 3 years ago

Reviewdog supports it, if you want shellcheck w/ Github Annotations.

  shellcheck:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: shellcheck
        uses: reviewdog/action-shellcheck@v1
        with:
          github_token: ${{ secrets.github_token }}
          reporter: github-pr-review
          path: "." # Optional.
          pattern: "*.sh" # Optional.
          filter_mode: nofilter # Optional.
          fail_on_error: true
cclauss commented 3 years ago

You can combine https://github.com/koalaman/shellcheck-precommit with https://github.com/pre-commit/action to autorun spellcheck locally on every commit and also in a GitHub Action on every push, pull, etc.

thomasleplus commented 3 years ago

I didn't know about this pre-commit github action. That's interesting. Thanks!

evulhotdog commented 3 years ago

I don't think that has the GitHub annotations. Reviewdog works out of the box.

thomasleplus commented 3 years ago

I don't think that has the GitHub annotations. Reviewdog works out of the box.

Can you please elaborate on the GitHub annotations? I am not sure that I know what you're referring to.

szepeviktor commented 3 years ago

Annotation simply appear in your PR-s and commits between two lines.

kép

You simply echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" from CI. https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-error-message

szepeviktor commented 3 years ago

Shellcheck needs a new formatter https://github.com/koalaman/shellcheck/tree/master/src/ShellCheck/Formatter In the meantime you can convert "checkstyle" to GHA annotations. For example there is https://github.com/staabm/annotate-pull-request-from-checkstyle for you.