Skip to content

Commit

Permalink
Only run some workflows on the bevy repo (not forks) (bevyengine#9872)
Browse files Browse the repository at this point in the history
# Objective

Eliminate unnecessary Actions CI builds on forks, such as:
- Daily builds, which are a waste of compute on forks, even if they
succeed (although the Android build fails)
- Administrative builds that attempt to deploy something

In both the cases above, forks get CI failures that need to be ignored.
It looks like this:

<img width="1178" alt="image"
src="https://github.com/bevyengine/bevy/assets/5838512/6365059a-1170-4bba-9c60-3e252ae7779f">

<img width="1186" alt="image"
src="https://github.com/bevyengine/bevy/assets/5838512/ab824a0b-5202-42f7-a24f-95c5cd53376c">


## Solution

- [Only run some jobs when they are in the `bevyengine/bevy`
repo.](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-run-job-for-specific-repository)
- Leave the rest of the workflows alone (you still get a full set of CI
for pull requests, for example)

---
  • Loading branch information
CleanCut authored and Ray Redondo committed Jan 9, 2024
1 parent 31a2591 commit 3f27787
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:

jobs:
build-for-iOS:
if: github.repository == 'bevyengine/bevy'
runs-on: macos-latest
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -38,6 +39,7 @@ jobs:
-F "custom_id=$GITHUB_RUN_ID"
build-for-Android:
if: github.repository == 'bevyengine/bevy'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -65,6 +67,7 @@ jobs:
-F "custom_id=$GITHUB_RUN_ID"
nonce:
if: github.repository == 'bevyengine/bevy'
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
Expand All @@ -74,6 +77,7 @@ jobs:
run: echo "result=${{ github.run_id }}-$(date +%s)" >> $GITHUB_OUTPUT

run:
if: github.repository == 'bevyengine/bevy'
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [nonce, build-for-iOS, build-for-Android]
Expand Down Expand Up @@ -112,6 +116,7 @@ jobs:
path: .github/start-mobile-example/*.png

check-result:
if: github.repository == 'bevyengine/bevy'
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [run]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
touch target/doc/.nojekyll
- name: Deploy
if: github.repository == 'bevyengine/bevy'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:

jobs:
ci:
if: github.repository == 'bevyengine/bevy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:

jobs:
ci:
if: github.repository == 'bevyengine/bevy'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit 3f27787

Please sign in to comment.