Skip to content

Commit

Permalink
ci: introduce reusable workflow to validate references in PR preview (#…
Browse files Browse the repository at this point in the history
…714)

covers #700
  • Loading branch information
tbouffard authored May 22, 2024
1 parent 6160a24 commit e6ee483
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 13 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/_reusable_pr-validate-references.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Required until we can use Antora 3.2. When GA will be available, this will be directly done with the build of the preview
name: 'Validate references of PR preview'

on:
workflow_call: # this allows the workflow to be reused
inputs:
build-preview-command:
description: 'The documentation `build-preview` command to build the preview and validate references. Mandatory when `component-name` is not set. Otherwise, ignored.'
required: false
type: string
component-name:
description: 'The name of the component to build. If set, the build-preview-command input is ignored'
required: false
default: ''
type: string
# needed by content repositories (default master) and by the doc-site repository (computed)
doc-site-branch:
description: 'The branch of the `bonita-documentation-site` used to build the site preview'
required: false
default: 'master'
type: string
fail-on-warning:
description: 'If true, fail the Antora build on warning.'
required: false
default: true
type: boolean

jobs:
validate_references:
runs-on: ubuntu-22.04
steps:
# This is a temporary implementation to switch from the composite action to the reusable action
# Once all repository will use it, the composite action will be removed and its content will be moved here
- uses: actions/checkout@v4 # access to the local action
- name: Validate references
uses: ./.github/actions/build-pr-site
with:
build-preview-command: ${{ inputs.build-preview-command }}
component-name: ${{ inputs.component-name }}
doc-site-branch: ${{ inputs.doc-site-branch }}
fail-on-warning: ${{ inputs.fail-on-warning }}
23 changes: 10 additions & 13 deletions .github/workflows/build-pr-site.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Validate references of PR preview, until we can use Antora 3.2. When GA will be available, this will be directly done with the build of the preview
name: PR Build documentation site
on:
pull_request:
Expand All @@ -6,6 +7,7 @@ on:
paths:
- '.github/actions/build-setup/**/*'
- '.github/actions/build-pr-site/**/*'
- '.github/workflows/_reusable_pr-validate-references.yml'
- '.github/workflows/build-pr-site.yml'
- '.nvmrc'
- 'resources/**/*'
Expand All @@ -16,16 +18,11 @@ on:

jobs:
build_site:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4 # access to the local action
- name: Validate xref
uses: ./.github/actions/build-pr-site
with:
doc-site-branch: ${{ github.head_ref }}
fail-on-warning: true
# '>' Replace newlines with spaces (folded)
# '-' No newline at end (strip)
build-preview-command: >-
./build-preview.bash
--single-branch-per-repo
uses: ./.github/workflows/_reusable_pr-validate-references.yml
with:
doc-site-branch: ${{ github.head_ref }}
# '>' Replace newlines with spaces (folded)
# '-' No newline at end (strip)
build-preview-command: >-
./build-preview.bash
--single-branch-per-repo

0 comments on commit e6ee483

Please sign in to comment.