From fda1aa8e7180e65c397faef4b3cd5cddfdabfa73 Mon Sep 17 00:00:00 2001
From: sanfrancrisko <ciaran.mccrisken@puppet.com>
Date: Tue, 9 Nov 2021 17:20:36 +0000
Subject: [PATCH] (MODULES-11220) Disable nightly workflows on forks

Although Github Actions are disabled on forks, a user can still manually enable them and encounter errors like that reported in [MODULES-11220](https://tickets.puppetlabs.com/browse/MODULES-11220).

This commit adds an `if` guard for the `Setup Test Matrix` and `slack-workflow-status` job and step, respectively
---
 moduleroot/.github/workflows/nightly.yml.erb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/moduleroot/.github/workflows/nightly.yml.erb b/moduleroot/.github/workflows/nightly.yml.erb
index bc909b2..8628a94 100644
--- a/moduleroot/.github/workflows/nightly.yml.erb
+++ b/moduleroot/.github/workflows/nightly.yml.erb
@@ -18,6 +18,7 @@ env:
 
 jobs:
   setup_matrix:
+    if: ${{ github.repository_owner == '<%= common['owner'] %>' }}
     name: "Setup Test Matrix"
     runs-on: ubuntu-20.04
     outputs:
@@ -197,7 +198,7 @@ jobs:
 
 <% if @configs['slack-notifications'] -%>
   slack-workflow-status:
-    if: always()
+    if: ${{ github.repository_owner == '<%= common['owner'] %>' }}
     name: Post Workflow Status To Slack
     needs:
       - Acceptance
-- 
GitLab