-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |