Skip to content

Commit

Permalink
add 'pre commit checks' workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
chizmw committed Apr 14, 2023
1 parent f7563c0 commit 23c991c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/unreleased/Added-20230414-160033.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: Added
body: add workflow to run pre-commit checks
time: 2023-04-14T16:00:33.720896+01:00
custom:
GithubIssue: ""
50 changes: 50 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# yamllint disable-line rule:truthy
on:
pull_request:

name: pre-commit

env:
# https://laszlo.cloud/setting-gopath-in-github-actions
GOPATH: /home/runner/work/woodpecker/go

jobs:
linting:
name: Run Checks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# https://github.com/actions/setup-python#usage
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: 3.x

# yamllint disable-line rule:line-length
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
- name: Update PATH
run: |
echo $PATH
echo "$GOPATH/bin" >> $GITHUB_PATH
- name: Install external deps for precommit
# yamllint disable rule:line-length
run: |
curl -fsSL https://raw.githubusercontent.com/infracost/infracost/master/scripts/install.sh | sh
go install github.com/sqs/goreturns@latest
go install github.com/securego/gosec/v2/cmd/gosec@latest
go install github.com/mgechev/revive@latest
go install golang.org/x/tools/cmd/goimports@latest
# goreturns doesn't share its version
# goimports doesn't share its version
gosec --version
revive --version
# yamllint enable rule:line-length

- name: Run precommit checks
run: |
pip install pre-commit
pre-commit run --all-files

0 comments on commit 23c991c

Please sign in to comment.