diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..15eb31c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,34 @@ +name: Lint + +on: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + # 1) Check out the code + - name: Check out repository + uses: actions/checkout@v3 + + # 2) Install and run ShellCheck on *.sh + - name: Install ShellCheck + run: | + sudo apt-get update + sudo apt-get install -y shellcheck + - name: Run ShellCheck + run: | + shellcheck ./*.sh + + # 3) Install Node and run markdownlint on *.md + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install markdownlint-cli + run: npm install -g markdownlint-cli + + - name: Run markdownlint + run: | + markdownlint ./**/*.md diff --git a/README.md b/README.md index 635d52e..e788e0a 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ # pre-commit-golang -Golang pre-commit hooks for http://pre-commit.com/ +Golang pre-commit hooks for [pre-commit.com](http://pre-commit.com/) -## install +## Installation -you need first to install [pre-commit](https://pre-commit.com/#install) +You first need to install [pre-commit](https://pre-commit.com/#install): -``` +```bash brew install pre-commit ``` -install pre-commit into your git repo +Then install pre-commit in your Git repository: -``` +```bash pre-commit install ``` ## Usage -Add a file named `.pre-commit-config.yaml` into the root directory of your repository +Add a file named `.pre-commit-config.yaml` to the root directory of your repository: ```yaml repos: - repo: https://github.com/Bahjat/pre-commit-golang - rev: v1.0.2 + rev: v1.0.5 hooks: - id: go-fmt-import - id: go-vet @@ -35,21 +35,22 @@ repos: - id: golangci-lint # requires github.com/golangci/golangci-lint args: [--config=.github/linters/.golangci.yml] # optional - id: go-ruleguard # requires https://github.com/quasilyte/go-ruleguard - args: [rules/rules.go] # required + args: [rules/rules.go] + - id: go-imports-reviser # requires https://github.com/incu6us/goimports-reviser ``` ## Contributing - Fork it -- Create your feature branch `git checkout -b my-new-feature` -- Commit your changes `git commit -am 'Add some feature'` -- Push to the branch `git push origin my-new-feature` -- Create new Pull Request +- Create your feature branch: `git checkout -b my-new-feature` +- Commit your changes: `git commit -am 'Add some feature'` +- Push to the branch: `git push origin my-new-feature` +- Create a new Pull Request ## Credits -This repo is inspired by [dnephin/pre-commit-golang](https://github.com/dnephin/pre-commit-golang) +This repository is inspired by [dnephin/pre-commit-golang](https://github.com/dnephin/pre-commit-golang). ## Finally -If you like this hooks please give a star +If you like these hooks, please give this repository a star!