Compare commits

..

1 Commits

Author SHA1 Message Date
agent-company 02a108a58e fix: add pull_request trigger to CI workflow so tests gate all PRs
Build and Push / test (pull_request) Successful in 3m33s
Build and Push / build (pull_request) Has been skipped
The CI workflow previously only triggered on push to master, meaning PRs
were not tested before merge. Add pull_request trigger for the test job
while restricting the Docker build+push job to push events only.

Closes leeworks-agents/gitea-mobile#204

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 15:04:58 +00:00
2 changed files with 7 additions and 34 deletions
+4
View File
@@ -4,6 +4,9 @@ on:
push: push:
branches: branches:
- master - master
pull_request:
branches:
- master
jobs: jobs:
test: test:
@@ -24,6 +27,7 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: test needs: test
if: gitea.event_name == 'push'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
+3 -34
View File
@@ -1,14 +1,10 @@
package main package main
import ( import (
"context"
"log" "log"
"log/slog" "log/slog"
"net/http" "net/http"
"os" "os"
"os/signal"
"syscall"
"time"
"gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/config" "gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/config"
giteaclient "gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/gitea" giteaclient "gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/gitea"
@@ -40,35 +36,8 @@ func main() {
handler = middleware.Auth(cfg.SessionSecret, cfg.GiteaToken)(handler) handler = middleware.Auth(cfg.SessionSecret, cfg.GiteaToken)(handler)
handler = middleware.Logging()(handler) handler = middleware.Logging()(handler)
srv := &http.Server{ slog.Info("server starting", "addr", cfg.ListenAddr, "gitea_url", cfg.GiteaURL)
Addr: cfg.ListenAddr, if err := http.ListenAndServe(cfg.ListenAddr, handler); err != nil {
Handler: handler, log.Fatalf("server error: %v", err)
} }
// Channel to receive shutdown signals.
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGTERM, syscall.SIGINT)
// Start server in a goroutine.
go func() {
slog.Info("server starting", "addr", cfg.ListenAddr, "gitea_url", cfg.GiteaURL)
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Fatalf("server error: %v", err)
}
}()
// Block until a shutdown signal is received.
sig := <-quit
slog.Info("shutdown signal received, draining in-flight requests", "signal", sig.String())
// Give in-flight requests up to 15 seconds to complete.
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
if err := srv.Shutdown(ctx); err != nil {
slog.Error("server forced to shutdown", "error", err)
os.Exit(1)
}
slog.Info("server stopped gracefully")
} }