Skip to content

chore: optimize workflow to avoid unnecessary runs (#15) #31

chore: optimize workflow to avoid unnecessary runs (#15)

chore: optimize workflow to avoid unnecessary runs (#15) #31

Workflow file for this run

name: Gateway CI
on:
push:
branches: [main]
paths:
- 'gateway/**'
- '.github/workflows/gateway.yml'
pull_request:
branches: [main]
jobs:
changes:
name: Detect changes
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.gateway }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
gateway:
- 'gateway/**'
- '.github/workflows/gateway.yml'
ci:
name: Vet · Test · Build
needs: changes
if: |
github.event_name == 'push' ||
needs.changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: gateway
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24.5'
cache-dependency-path: gateway/go.sum
- name: Vet
run: go vet ./...
- name: Test (race detector)
run: go test -race -count=1 ./...
- name: Build
run: CGO_ENABLED=0 go build -trimpath ./cmd/rep-gateway
gateway-status:
name: Gateway Status
if: always() && github.event_name == 'pull_request'
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Check result
run: |
if [ "${{ needs.ci.result }}" = "failure" ] || [ "${{ needs.ci.result }}" = "cancelled" ]; then
echo "Gateway CI failed or was cancelled"
exit 1
fi
echo "Gateway CI passed or was skipped"