Currently, for PRs opened by external contributors, the various lint checks don't run (sometimes causing code that fails basic lint checks to be committed to main). From my current understanding (I find the docs around this confusing), we need to instead use the "pull_request" target. Refs: * https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request * https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/ Note that even then, we will need a manual step to approve running the lints for first time contributors. Which is fine, at least we'll see the option, unlike right now where they just can't be run until the code hits main.
32 lines
832 B
YAML
32 lines
832 B
YAML
name: "Lint (server)"
|
|
|
|
on:
|
|
# Run on every pull request (open or push to it) that changes server/
|
|
pull_request:
|
|
paths:
|
|
- "server/**"
|
|
- ".github/workflows/server-lint.yml"
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: server/go.mod
|
|
cache-dependency-path: server/go.sum
|
|
cache: true
|
|
|
|
- name: Install dependencies
|
|
run: sudo apt-get update && sudo apt-get install libsodium-dev
|
|
|
|
- name: Lint
|
|
run: "./scripts/lint.sh"
|