From 2f87bb8c1ff721e75e8a40aec1a181ee725b7cd8 Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Wed, 8 May 2024 10:15:21 -0400 Subject: [PATCH] Don't deploy docs when working on a fork (#13278) # Objective - Some developers enable Github Actions for their fork and commit directly to main. This triggers the `docs.yml` action, which attempts to deploy the documentation even if Github Pages is not enabled. (It also creates a `CNAME` file specific to Bevy and should not be used in forks, even for testing.) - For an example, see [this run](https://github.com/tychedelia/bevy/actions/runs/8978912060/job/24660082729). ## Solution - Only attempt to deploy docs when running from the main Bevy repository. - This does not affect us checking `cargo doc` on pull requests, since that it done in `ci.yml`. ## Testing It's difficult to test this, but you'd probably: 1. Fork Bevy 2. Cherry pick this PR's commits onto the main branch of your fork. 3. Push another commit to the main branch, triggering Github Actions. 4. Check the Github Actions job summary to ensure that the `build-and-deploy` job is skipped. --- .github/workflows/docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e4002371d6..49e6b2cd49 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -27,6 +27,9 @@ concurrency: jobs: build-and-deploy: runs-on: ubuntu-latest + # Only run this job when on the main Bevy repository. Without this, it would also run on forks + # where developers work on the main branch but have not enabled Github Pages. + if: ${{ github.repository == 'bevyengine/bevy' }} environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}