Skip to content

Commit

Permalink
Allow external PRs to pass Docs build and deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Nov 21, 2023
1 parent cc43144 commit bcbf42a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/docs-deploy-firebase.patch-external.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Workflow patches for skipping Google Cloud docs updates on PRs from external repositories.
name: Docs

# Run on PRs from external repositories, let them pass, and then Mergify will check them.
# GitHub doesn't support filtering workflows by source branch names, so we have to do it for each
# job.
on:
pull_request:

# IMPORTANT
#
# These job names must be kept in sync with the `.patch.yml` and `.yml` files.
jobs:
build-docs-book:
name: Build and Deploy Zebra Book Docs
# Only run on PRs from external repositories.
# (github.ref is always a local branch, so this check will skip non-PRs as well.)
if: ${{ !contains(github.head_ref || github.ref, 'refs/heads/') }}
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

build-docs-internal:
name: Build and Deploy Zebra Internal Docs
# This dependency allows all these jobs to depend on a single condition, making it easier to
# change.
needs: build-docs-book
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
9 changes: 6 additions & 3 deletions .github/workflows/docs-deploy-firebase.patch.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Workflow patches for skipping Google Cloud docs updates when docs, Rust code, or dependencies
# aren't modified in a PR.
name: Docs

# Run on PRs with unmodified docs, code, and dependency files.
on:
pull_request:
branches:
- main
paths-ignore:
# doc source files
- 'book/**'
Expand All @@ -20,6 +21,9 @@ on:
# workflow definitions
- '.github/workflows/docs-deploy-firebase.yml'

# IMPORTANT
#
# These job names must be kept in sync with the `.patch-external.yml` and `.yml` files.
jobs:
build-docs-book:
name: Build and Deploy Zebra Book Docs
Expand All @@ -29,7 +33,6 @@ jobs:

build-docs-internal:
name: Build and Deploy Zebra Internal Docs
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
13 changes: 11 additions & 2 deletions .github/workflows/docs-deploy-firebase.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Google Cloud docs updates that run when docs, Rust code, or dependencies are modified,
# but only on PRs from the ZcashFoundation/zebra repository. (External PRs are deployed by mergify.)
name: Docs

# Ensures that only one workflow task will run at a time. Previous deployments, if
Expand All @@ -9,7 +11,9 @@ concurrency:

on:
workflow_dispatch:

push:
# Skip main branch updates where docs, Rust code, and dependencies aren't modified.
branches:
- main
paths:
Expand All @@ -29,8 +33,7 @@ on:
- '.github/workflows/docs-deploy-firebase.yml'

pull_request:
branches:
- main
# Skip PRs where docs, Rust code, and dependencies aren't modified.
paths:
# doc source files
- 'book/**'
Expand Down Expand Up @@ -60,9 +63,14 @@ env:
# https://github.com/ZcashFoundation/zebra/blob/main/.cargo/config.toml#L87
RUSTDOCFLAGS: --html-in-header katex-header.html -D warnings -A rustdoc::private_intra_doc_links

# IMPORTANT
#
# These job names must be kept in sync with the `.patch.yml` and `.patch-external.yml` files.
jobs:
build-docs-book:
name: Build and Deploy Zebra Book Docs
# Skip PRs from external repositories, let them pass, and then Mergify will check them
if: ${{ contains(github.head_ref || github.ref, 'refs/heads/') }}
timeout-minutes: 5
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -116,6 +124,7 @@ jobs:

build-docs-internal:
name: Build and Deploy Zebra Internal Docs
if: ${{ contains(github.head_ref || github.ref, 'refs/heads/') }}
timeout-minutes: 45
runs-on: ubuntu-latest
permissions:
Expand Down

0 comments on commit bcbf42a

Please sign in to comment.