Skip to content

Commit

Permalink
ci: Ensure the CD-related workflows won't run on forks (#446)
Browse files Browse the repository at this point in the history
* release.yml: Run only upstream
* deploy-master.yml: Run only upstream
* build-and-test.yml: Run always, but schedules run only upstream
* static-builds.yml: Run always, but schedules run only upstream
* build-macos.yml: (Kept as is)
  • Loading branch information
erikmd committed Oct 13, 2021
1 parent 881982a commit 6b8c49b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/build-and-test.yml
Expand Up @@ -14,6 +14,7 @@ on:
jobs:
build_test_server:
name: Build learn-ocaml and run tests
if: ${{ github.event_name != 'schedule' || github.repository == 'ocaml-sf/learn-ocaml' }}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand All @@ -29,6 +30,7 @@ jobs:

client_using_other_server:
name: Build learn-ocaml-client and run quick tests
if: ${{ github.event_name != 'schedule' || github.repository == 'ocaml-sf/learn-ocaml' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -53,6 +55,7 @@ jobs:

build_extra_tests:
name: Run dockerized tests
if: ${{ github.event_name != 'schedule' || github.repository == 'ocaml-sf/learn-ocaml' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-master.yml
Expand Up @@ -10,6 +10,7 @@ on:
jobs:
push_server:
name: Push learn-ocaml image to Docker Hub
if: ${{ github.repository == 'ocaml-sf/learn-ocaml' }}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand All @@ -26,6 +27,7 @@ jobs:
tags: master
push_client:
name: Push learn-ocaml-client image to Docker Hub
if: ${{ github.repository == 'ocaml-sf/learn-ocaml' }}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand All @@ -43,6 +45,7 @@ jobs:
tags: master
push_emacs_client:
name: Push emacs-learn-ocaml-client image to Docker Hub
if: ${{ github.repository == 'ocaml-sf/learn-ocaml' }}
needs: push_client
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -19,7 +19,7 @@ jobs:
release-please:
name: Create Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'ocaml-sf/learn-ocaml'}}
outputs:
release_created: ${{ steps.release.outputs.release_created }}
upload_url: ${{ steps.release.outputs.upload_url }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/static-builds.yml
Expand Up @@ -14,6 +14,7 @@ on:
jobs:
static-bin-linux:
name: Builds static Linux binaries
if: ${{ github.event_name != 'schedule' || github.repository == 'ocaml-sf/learn-ocaml' }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
path: ${{ matrix.artifact }}
static-bin-macos:
name: Builds static Macos binaries
if: ${{ github.event_name != 'schedule' || github.repository == 'ocaml-sf/learn-ocaml' }}
runs-on: macos-latest
env:
OPAMYES: 1
Expand Down

0 comments on commit 6b8c49b

Please sign in to comment.