From 34a7f1ec5527f2d19b232b8e2654a329542b5cfc Mon Sep 17 00:00:00 2001
From: Sergey Bronnikov <sergeyb@tarantool.org>
Date: Tue, 9 Aug 2022 10:24:12 +0300
Subject: [PATCH] ci: fix conditions in publishing workflow

Publishing workflow will run building module API documentation for
opened or reopened pull request with label "full-ci" and will publish
documentation on Github Pages on push to the master branch.

NO_CHANGELOG=ci
NO_DOC=ci
NO_TEST=ci
---
 .github/workflows/publish-module-api-doc.yaml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/.github/workflows/publish-module-api-doc.yaml b/.github/workflows/publish-module-api-doc.yaml
index 4e5841f070..1b52a4e5ce 100644
--- a/.github/workflows/publish-module-api-doc.yaml
+++ b/.github/workflows/publish-module-api-doc.yaml
@@ -3,9 +3,17 @@ name: Publish module API documentation
 on:
   push:
     branches: [master]
+  pull_request:
+    types: [opened, reopened, synchronize, labeled]
+  workflow_dispatch:
 
 jobs:
   publish-api-doc:
+    # Run on push to the branch 'master' or on pull request if the 'full-ci'
+    # label is set.
+    if: github.repository == 'tarantool/tarantool' &&
+        ( github.event_name != 'pull_request' ||
+          contains(github.event.pull_request.labels.*.name, 'full-ci') )
     runs-on: ubuntu-latest
     steps:
       - uses: tarantool/actions/cleanup@master
@@ -28,6 +36,8 @@ jobs:
         uses: JamesIves/github-pages-deploy-action@v4.4.0
         with:
           folder: doc/
+        if: github.ref == 'refs/heads/master' &&
+            github.event_name != 'pull_request'
 
       - name: Send VK Teams message on failure
         if: failure()
-- 
GitLab