You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/01/08 08:35:40 UTC

[buildstream] branch master updated: .github/workflows/ci.yml: Enhance CI run conditions

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/buildstream.git


The following commit(s) were added to refs/heads/master by this push:
     new 1d669eb  .github/workflows/ci.yml: Enhance CI run conditions
1d669eb is described below

commit 1d669eb9284f596b19e3579d1f28ba0291b46ee9
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Fri Jan 8 17:33:21 2021 +0900

    .github/workflows/ci.yml: Enhance CI run conditions
    
    The current setup would end up running CI double when creating
    pull requests from branches in the base repo. This commit filters
    out pull requests which occur in the base repo by assuming that
    branches from forked repos have colons in their names.
---
 .github/workflows/ci.yml | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 39344bc..e9f35c9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,10 +1,11 @@
 name: PR Checks
 
-# We don't run these jobs on pull requests because:
-# 1. it is often useful to run tests on one's branch without creating a pull
-#    request, and
-# 2. running on both pushes and pull requests results in the classic problem of
-#    having double jobs.
+# Run the CI if branches are pushed locally, allowing us to
+# run CI without the need of creating a pull request.
+#
+# Run the CI on pull requests only if they are from forked
+# repositories.
+#
 on:
   push:
     branches-ignore:
@@ -12,6 +13,13 @@ on:
     - master
   pull_request:
     types: [assigned, opened, synchronize, reopened]
+    branches:
+      # Branches from forks have the form 'user:branch-name' so we only run
+      # this job on pull_request events for branches that look like fork
+      # branches. Without this we would end up running this job twice for non
+      # forked PRs, once for the push and then once for opening the PR.
+    - '**:**'
+
 
 # Left to-do:
 # - coverage