From 5d034df9765465af6d193f14ddb9f091b46e88a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20T=C3=B6lle?= <julian.toelle@hetzner-cloud.de>
Date: Wed, 19 Jul 2023 12:16:02 +0200
Subject: [PATCH] ci: only run ci.yml once per PR (#480)

The current rules will create all the jobs in ci.yml twice for PRs. Once
with the pull_request event, and then once again because the commit was
pushed. This is annoying and wastes CI resources.

This fixes it by only running for PRs and pushes to main (instead of all
branches). The same config is already used for the e2e tests.
---
 .github/workflows/ci.yml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1835d974..f2433c03 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,6 +1,11 @@
 ---
 name: Run tests
-on: [ push, pull_request ]
+
+on:
+  push:
+    branches: [main]
+  pull_request:
+
 jobs:
   test:
     name: Unit Tests
-- 
GitLab