Merge pull request 'Prepare for next release' (#13) from main into release
All checks were successful
Release / Release (push) Successful in 57s

Reviewed-on: #13
This commit is contained in:
Jan K9f 2025-04-09 17:48:31 +00:00
commit c142133a34
Signed by:
GPG key ID: 944223E4D46B7412
4 changed files with 44 additions and 1 deletions

29
.gitea/workflows/CI.yml Normal file
View file

@ -0,0 +1,29 @@
name: "Go CI"
on:
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.24.2
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.0
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.24.2
- name: Test
run: go test ./...

4
.golangci.yml Normal file
View file

@ -0,0 +1,4 @@
version: "2"
linters:
enable:
- revive

View file

@ -1,3 +1,4 @@
// Package validation General validation tasks
package validation
import (
@ -6,6 +7,7 @@ import (
"strings"
)
// ValidateConventionalCommit validates if string follows conventional commit
func ValidateConventionalCommit(commit string) error {
// Regex to match the commit format
// type(scope)!: description

10
main.go
View file

@ -1,3 +1,4 @@
// Package main is the main package
package main
import (
@ -8,6 +9,7 @@ import (
"git.kjan.de/actions/pull-request-lint/internal/validation"
)
// GithubEvent represents a github actions event
type GithubEvent struct {
PullRequest struct {
Title string `json:"title"`
@ -26,7 +28,13 @@ func main() {
fmt.Printf("Error opening %s: %v\n", eventPath, err)
os.Exit(1)
}
defer eventFile.Close()
defer func() {
closeFileErr := eventFile.Close()
if closeFileErr != nil {
fmt.Println("Error closing eventFile")
os.Exit(1)
}
}()
var event GithubEvent
decoder := json.NewDecoder(eventFile)