From 48b4f4fe711b9a5a45c0f7acdea37b00cc43ee45 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 28 Aug 2022 13:34:22 -0400 Subject: [PATCH 1/4] Limit deploy to has pages --- .github/workflows/deploy_production.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_production.yml b/.github/workflows/deploy_production.yml index fdf8b25a91c..805128cf078 100644 --- a/.github/workflows/deploy_production.yml +++ b/.github/workflows/deploy_production.yml @@ -17,7 +17,7 @@ jobs: outputs: # To avoid deploying documentation for unrelease changes, we check the number of changeset files. # If it's 0, we deploy. - should_deploy: ${{ steps.changeset-count.outputs.change_count == 0 }} + should_deploy: ${{ steps.changeset-count.outputs.change_count == 0 && steps.has-pages.outputs.pages == 1 }} steps: - uses: actions/checkout@v2 @@ -28,6 +28,16 @@ jobs: - name: Log changeset count run: echo ${{ steps.changeset-count.outputs.change_count }} + - id: has-pages + name: Check if pages is configured + run: | + if gh api --silent https://api.github.com/repos/${{ github.repository }}/pages ; then + echo "::set-output name=pages::1" + fi + + - name: Log has pages + run: echo ${{ steps.has-pages.outputs.pages }} + # Log guard output for debugging purposes - name: Log guard output run: echo ${{ needs.guard.outputs.should_deploy }} From 6f1f294521b3087a34c18cac6712b54469aa04d7 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 28 Aug 2022 13:37:24 -0400 Subject: [PATCH 2/4] Limit statuses to primer/react --- .github/workflows/statuses.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/statuses.yml b/.github/workflows/statuses.yml index ed98e0652c0..d8e23412458 100644 --- a/.github/workflows/statuses.yml +++ b/.github/workflows/statuses.yml @@ -11,6 +11,7 @@ on: jobs: build-and-deploy: name: Update status project + if: ${{ github.repository == 'primer/react' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 2408bbca3af892279dbe3b929ac9c4f5cb7759b9 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 28 Aug 2022 13:38:34 -0400 Subject: [PATCH 3/4] Limit stale to primer/react --- .github/workflows/stale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 97176bcc53f..81e73c719bb 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,6 +6,7 @@ on: jobs: stale: runs-on: ubuntu-latest + if: ${{ github.repository == 'primer/react' }} steps: - uses: actions/stale@v4 with: From 5fd7c6b0c6bc51fc501fc56275d3a7efe232ae9a Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 28 Aug 2022 13:40:18 -0400 Subject: [PATCH 4/4] Preview cross org forks --- .github/workflows/deploy_preview_forks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_preview_forks.yml b/.github/workflows/deploy_preview_forks.yml index f049e73ad8b..3acb8db4f21 100644 --- a/.github/workflows/deploy_preview_forks.yml +++ b/.github/workflows/deploy_preview_forks.yml @@ -9,8 +9,8 @@ permissions: jobs: deploy-preview: - # target repository for pull_request is primer/react but source repository isn't primer/react - if: ${{ github.repository == 'primer/react' && github.event.pull_request.head.repo.full_name != 'primer/react' }} + # target repository for pull_request is different from source repository + if: ${{ github.repository != github.event.pull_request.head.repo.full_name }} name: Preview uses: primer/.github/.github/workflows/deploy_preview.yml@main permissions: