From d2240bf7c9ec33c45b24626398765b47e12eebe5 Mon Sep 17 00:00:00 2001
From: Sergey Kaplun <skaplun@tarantool.org>
Date: Fri, 21 Jun 2024 09:02:39 +0300
Subject: [PATCH] ci: avoid sending perf stat to Influx from forks

This patch is the follow-up for the commit
49946a72b72884d4f84269b90e6a61 ("ci: send perf statistics to InfluxDB").
Since secrets are unavailable for fork repositories, the sending step
fails due to a missed InfluxDB URL and token. This patch allows to run
this step only for on push events or PRs from the main repository
itself.

NO_DOC=CI
NO_CHANGELOG=CI
NO_TEST=CI
---
 .github/workflows/perf_micro.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.github/workflows/perf_micro.yml b/.github/workflows/perf_micro.yml
index af649a86ab..99b9f4f523 100644
--- a/.github/workflows/perf_micro.yml
+++ b/.github/workflows/perf_micro.yml
@@ -79,6 +79,11 @@ jobs:
       - name: Aggregate benchmark results
         run: make -f .test.mk test-perf-aggregate
       - name: Send statistics to InfluxDB
+        # Run on push to the 'master' and release branches or on
+        # non-fork pull requests (secrets are unavailable in fork
+        # pull requests).
+        if: github.event_name != 'pull_request' ||
+          github.event.pull_request.head.repo.full_name == github.repository
         # TODO: For now, use the debug bucket for this PoC.
         # --silent -o /dev/null: Prevent dumping any reply part
         # in the output in case of an error.
-- 
GitLab