Skip to content

adds a GitHub Actions workflow runs on pull requests #21

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

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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!