fix(ci): run the lint/codegen/test gate on pull requests, not only pushes

ci.yml triggered only on push, but a fork PR's commits never push to this repo,
so its lint-and-test job (eslint, vitest, and the GraphQL codegen-freshness
check) never ran for forks. e2e.yml, the only workflow a fork PR did trigger,
builds with tsc — which reads the committed types.ts and cannot see it go stale.
So a fork editing schema.graphqls without regenerating, or shipping a lint/test
failure, could merge green.

Add a pull_request trigger (lint-and-test uses no secrets and is fork-safe) and
narrow push to main + tags, which is all docker-build — gated to those refs
already — needs. A concurrency group drops superseded PR-sync runs. The
codegen-detect step already treats an empty `github.event.before` as "check
anyway", so pull_request events always run the freshness check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-25 03:47:12 +07:00
co-authored by Claude Opus 4.8
parent 0d4232a1d5
commit dc7eedfae4
+23 -12
View File
@@ -1,13 +1,24 @@
name: Docker build and push
on:
# pull_request so the lint/codegen/test gate runs on fork PRs too: a fork's commits never push to
# this repo, so a push-only trigger let a fork edit the schema without regenerating types.ts (or
# ship a lint/test failure) and merge green, since e2e.yml's tsc build cannot see stale codegen.
# lint-and-test uses no secrets and is fork-safe; docker-build stays gated to main/tags below.
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- "**"
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
# A PR's synchronize pushes supersede each other; keep only the latest run per ref.
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
@@ -32,7 +43,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'
go-version: "1.24"
cache: true
cache-dependency-path: backend/go.sum
@@ -47,8 +58,8 @@ jobs:
uses: actions/setup-node@v6
with:
node-version-file: frontend/.nvmrc
cache: 'pnpm'
cache-dependency-path: 'frontend/pnpm-lock.yaml'
cache: "pnpm"
cache-dependency-path: "frontend/pnpm-lock.yaml"
# Frontend lint and test
- name: Frontend - Install dependencies
@@ -135,17 +146,17 @@ jobs:
PACKAGE_VER=${LATEST_TAG#v}
CURRENT_COMMIT=$(git rev-parse HEAD)
TAG_COMMIT=$(git rev-list -n 1 "$LATEST_TAG" 2>/dev/null || echo "")
if [ "$CURRENT_COMMIT" != "$TAG_COMMIT" ]; then
PACKAGE_REV=$(git rev-parse --short HEAD)
else
PACKAGE_REV=""
fi
LDFLAGS="-X pentagi/pkg/version.PackageName=pentagi -X pentagi/pkg/version.PackageVer=${PACKAGE_VER} -X pentagi/pkg/version.PackageRev=${PACKAGE_REV}"
echo "Building with version: ${PACKAGE_VER}${PACKAGE_REV:+-$PACKAGE_REV}"
# Build for AMD64
GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "$LDFLAGS" -o /tmp/pentagi-amd64 ./cmd/pentagi
echo "✓ Successfully built for linux/amd64"
@@ -181,13 +192,13 @@ jobs:
# Get latest tag version (without 'v' prefix)
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
VERSION=${LATEST_TAG#v}
# Get current commit hash
CURRENT_COMMIT=$(git rev-parse HEAD)
# Get commit hash of the latest tag
TAG_COMMIT=$(git rev-list -n 1 "$LATEST_TAG" 2>/dev/null || echo "")
# Set revision only if current commit differs from tag commit
if [ "$CURRENT_COMMIT" != "$TAG_COMMIT" ]; then
PACKAGE_REV=$(git rev-parse --short HEAD)
@@ -207,7 +218,7 @@ jobs:
echo "patch=${VERSION}" >> $GITHUB_OUTPUT
echo " Docker tags: latest, ${major}, ${major}.${minor}, ${VERSION}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Generate Docker metadata