3e05c75542
ci / shared (pull_request) Failing after 34s
The original ci.yaml used wagoid/commitlint-github-action and
gitleaks/gitleaks-action, both of which hit GitHub-specific API
endpoints that 404 on Gitea ("error trying to get list of pull
request's commits: not found").
Changes:
- commitlint: bash regex against Conventional Commits, scoped to the
PR commit range. Zero external deps.
- gitleaks: inline tarball download + binary run, exit-code 1 on
any finding.
- trivy: unchanged (works fine; uses local fs scan).
- Per-stack test/image/e2e jobs now gated on hashFiles(go.sum) /
hashFiles(package.json) / hashFiles(Dockerfile) so they skip
cleanly on empty repos and light up automatically when real code
lands (M4.1, M5.1, etc.).
Refs: M0.2
58 lines
1.9 KiB
YAML
58 lines
1.9 KiB
YAML
# CI skeleton — applies to every repo until per-stack code lands.
|
|
# The `shared` job runs on every push + PR; per-stack `test`/`image`/`e2e`
|
|
# jobs light up automatically when the repo gains go.sum / package.json /
|
|
# Cargo.toml etc. — see the conditional gates below.
|
|
name: ci
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
shared:
|
|
runs-on: docker
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with: { fetch-depth: 0 }
|
|
|
|
- name: commitlint (PR only)
|
|
if: github.event_name == 'pull_request'
|
|
shell: bash
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
set -euo pipefail
|
|
pattern='^(feat|fix|docs|chore|refactor|test|perf|build|ci|revert)(\([a-z0-9_/.-]+\))?!?: .{1,72}$'
|
|
bad=0
|
|
while IFS= read -r subject; do
|
|
if ! [[ "$subject" =~ $pattern ]]; then
|
|
echo "::error::Commit subject does not match Conventional Commits: $subject"
|
|
bad=$((bad+1))
|
|
fi
|
|
done < <(git log --format=%s "${BASE_SHA}..${HEAD_SHA}")
|
|
if [ "$bad" -gt 0 ]; then
|
|
echo "::error::$bad commit(s) failed commitlint. See https://www.conventionalcommits.org/"
|
|
exit 1
|
|
fi
|
|
echo "commitlint: all commit subjects OK"
|
|
|
|
- name: gitleaks
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
GL_VERSION=8.18.4
|
|
curl -fsSL "https://github.com/gitleaks/gitleaks/releases/download/v${GL_VERSION}/gitleaks_${GL_VERSION}_linux_x64.tar.gz" \
|
|
| tar -xz -C /tmp gitleaks
|
|
/tmp/gitleaks detect --source . --no-banner --redact --verbose --exit-code 1
|
|
|
|
- name: trivy fs scan
|
|
uses: aquasecurity/trivy-action@master
|
|
with:
|
|
scan-type: fs
|
|
severity: HIGH,CRITICAL
|
|
exit-code: 1
|
|
ignore-unfixed: true
|