From 6050e6867ef9538d39cbfd2d751a1bf16b52ac15 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 2 Apr 2024 15:28:47 +0100 Subject: [PATCH] Do not run nightly or scheduled builds on private repos --- .github/workflows/nightly.yml | 5 +++++ .github/workflows/scheduled.yml | 5 +++++ .../templates/workflow-requirements-check.yml.jinja | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 3a7db8b4c2b..1fbbd65e6d0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -57,6 +57,11 @@ jobs: echo "${MSG}" echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" echo "requirements-met=false" >> "${GITHUB_OUTPUT}" + elif [ "${{ github.event.repository.private }}" = "true" ]; then + MSG="Not running workflow because ${{ github.repository }} is a private repository" + echo "${MSG}" + echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" + echo "requirements-met=false" >> "${GITHUB_OUTPUT}" else MSG="Running workflow because ${{ github.repository }} is not a fork" echo "${MSG}" diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 0bd6ef698a2..724b529fb74 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -47,6 +47,11 @@ jobs: echo "${MSG}" echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" echo "requirements-met=false" >> "${GITHUB_OUTPUT}" + elif [ "${{ github.event.repository.private }}" = "true" ]; then + MSG="Not running workflow because ${{ github.repository }} is a private repository" + echo "${MSG}" + echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" + echo "requirements-met=false" >> "${GITHUB_OUTPUT}" else MSG="Running workflow because ${{ github.repository }} is not a fork" echo "${MSG}" diff --git a/.github/workflows/templates/workflow-requirements-check.yml.jinja b/.github/workflows/templates/workflow-requirements-check.yml.jinja index 419ee3f6f52..67e04eef3e7 100644 --- a/.github/workflows/templates/workflow-requirements-check.yml.jinja +++ b/.github/workflows/templates/workflow-requirements-check.yml.jinja @@ -21,6 +21,11 @@ echo "${MSG}" echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" echo "requirements-met=false" >> "${GITHUB_OUTPUT}" + elif [ "${{ github.event.repository.private }}" = "true" ]; then + MSG="Not running workflow because ${{ github.repository }} is a private repository" + echo "${MSG}" + echo "${MSG}" >> "${GITHUB_STEP_SUMMARY}" + echo "requirements-met=false" >> "${GITHUB_OUTPUT}" else MSG="Running workflow because ${{ github.repository }} is not a fork" echo "${MSG}"