All checks were successful
CI / Check PR Title (push) Has been skipped
CI / Go Lint (push) Successful in 36s
CI / Makefile Lint (push) Successful in 35s
CI / Markdown Lint (push) Successful in 22s
CI / Unit Tests (push) Successful in 35s
CI / Fuzz Tests (push) Successful in 1m6s
CI / Mutation Tests (push) Successful in 1m10s
## Description Currently, the `check-pr-title` job has a security vulnerability. If you give the PR a bad title, the job can run arbitrary code. ## Changes - Fix prompt injection by pulling the PR title as an environment variable. - Also, restricted the job to only `pull_request` trigger. ### Design Decisions - It is better to pull out this job into a separate workflow with a unique trigger, but I chose not to because it is currently only one job. ## Checklist - [x] Tests pass - [x] Docs updated Reviewed-on: #18 Co-authored-by: M.V. Hutz <git@maximhutz.me> Co-committed-by: M.V. Hutz <git@maximhutz.me>
104 lines
2.2 KiB
YAML
104 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
check-pr-title:
|
|
name: Check PR Title
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
TITLE: ${{ gitea.event.pull_request.title }}
|
|
steps:
|
|
- run: |
|
|
if ! echo "$TITLE" | grep -qE '^(WIP: )?(feat|fix|docs|chore|ci|test|refactor|perf|build|style|revert)(\(.+\))?(!)?: .+'; then
|
|
echo "::error::Pull Request title must follow conventional commits"
|
|
exit 1
|
|
fi
|
|
|
|
lint-go:
|
|
name: Go Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Check go mod tidy
|
|
run: go mod tidy && git diff --exit-code go.mod go.sum
|
|
|
|
- uses: golangci/golangci-lint-action@v7
|
|
with:
|
|
version: latest
|
|
|
|
lint-makefile:
|
|
name: Makefile Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Install gremlins
|
|
run: go install github.com/checkmake/checkmake/cmd/checkmake@latest
|
|
|
|
- name: Run mutation tests
|
|
run: make lint-makefile
|
|
|
|
lint-markdown:
|
|
name: Markdown Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: DavidAnson/markdownlint-cli2-action@v19
|
|
|
|
test-unit:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run unit tests
|
|
run: make test-unit
|
|
|
|
test-fuzz:
|
|
name: Fuzz Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run fuzz tests
|
|
run: make test-fuzz
|
|
|
|
test-mutation:
|
|
name: Mutation Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Install gremlins
|
|
run: go install github.com/go-gremlins/gremlins/cmd/gremlins@latest
|
|
|
|
- name: Run mutation tests
|
|
run: make test-mutation
|