fix: readme lint

This commit is contained in:
Urko. 2024-04-29 21:19:03 +02:00
parent 422fedf9cd
commit fe002edab1
1 changed files with 22 additions and 5 deletions

View File

@ -1,25 +1,35 @@
# git-webhook-ci # git-webhook-ci
Tool to automatize your deploy based on file write changes Tool to automatize your deploy based on file write changes
## Description ## Description
After some change is made in our listener file the script placed on path set on `env` variable called **WEBHOOK_SCRIPT_PATH** will be executed. After some change is made in our listener file the script placed on path set on `env` variable called **WEBHOOK_SCRIPT_PATH** will be executed.
## Context ## Context
As a security risk that could be allow a webhook listener on a VPS for your git repository, I've decided As a security risk that could be allow a webhook listener on a VPS for your git repository, I've decided
to create this package which is a listener to file changes on write. This will trigger a bash script which to create this package which is a listener to file changes on write. This will trigger a bash script which
you shold place on your server to run desired tasks. In my case I've done this to run a bash deploy command like you shold place on your server to run desired tasks. In my case I've done this to run a bash deploy command like
- git pull
- build - git pull
- move build to desired dir - build
- restart services like nginx or whatever - move build to desired dir
- restart services like nginx or whatever
## Installation ## Installation
### Requirements ### Requirements
- [Go version > 1.19](https://go.dev/dl/) - [Go version > 1.19](https://go.dev/dl/)
- [GNU Make 4.3](https://www.gnu.org/software/make/) - [GNU Make 4.3](https://www.gnu.org/software/make/)
- [goreportcard-cli](https://github.com/gojp/goreportcard) - [goreportcard-cli](https://github.com/gojp/goreportcard)
- [golangci-lint](https://golangci-lint.run/) - [golangci-lint](https://golangci-lint.run/)
### Environment Vars ### Environment Vars
As shown in .env.example you have to configure this variables in order to make your binary works right: As shown in .env.example you have to configure this variables in order to make your binary works right:
```.env ```.env
SCRIPT_BINARY_PATH=/bin/bash SCRIPT_BINARY_PATH=/bin/bash
WEBHOOK_SCRIPT_PATH=/path/to/mybashscript.sh WEBHOOK_SCRIPT_PATH=/path/to/mybashscript.sh
@ -30,17 +40,23 @@ TEST_FILE_TO_WATCH_PATH=./test_monitor.txt
**TEST_FILE_TO_WATCH_PATH** is needed just to run tests **TEST_FILE_TO_WATCH_PATH** is needed just to run tests
## How to use ## How to use
### Build ### Build
To build you can only just `make build` command To build you can only just `make build` command
```bash ```bash
make build make build
``` ```
## Tests ## Tests
```bash ```bash
make test-coverage make test-coverage
``` ```
output: output:
```terminal ```terminal
coverage: 80.0% of statements coverage: 80.0% of statements
ok gitea.urkob.com/urko/git-webhook-ci/internal/watcher 2.024s coverage: 80.0% of statements ok gitea.urkob.com/urko/git-webhook-ci/internal/watcher 2.024s coverage: 80.0% of statements
@ -49,6 +65,7 @@ ok gitea.urkob.com/urko/git-webhook-ci/pkg/watcher 0.017s coverage: 100.0%
``` ```
## goreportcard ## goreportcard
```bash ```bash
➜ git-webhook-ci git:(main) ✗ make goreportcard ➜ git-webhook-ci git:(main) ✗ make goreportcard
oreportcard-cli -v oreportcard-cli -v