Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,36 @@ jobs:
build:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull_request') }}
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
persist-credentials: false

- name: Get changed files
if: github.event_name == 'pull_request_target'
if: startsWith(github.event_name, 'pull_request') || github.event_name == 'merge_group'
id: check-files
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
with:
files: ${{ inputs.path-pattern != '' && inputs.path-pattern || '**' }}

- name: Free Disk Space
if: github.event_name != 'merge_group'
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Checkout
if: github.event_name == 'push' || steps.check-files.outputs.any_changed == 'true'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
persist-credentials: false


- name: Create Deployment
if: github.event_name == 'push' || steps.check-files.outputs.any_changed == 'true'
if: github.event_name == 'push' || (steps.check-files.outputs.any_changed == 'true' && startsWith(github.event_name, 'pull_request'))
uses: actions/github-script@v7
id: deployment
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
REF: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref_name }}
REF: ${{ startsWith(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.ref_name }}
with:
result-encoding: string
script: |
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
case "${GITHUB_EVENT_NAME}" in
"pull_request_target")
"merge_group" | "pull_request" | "pull_request_target")
echo "PATH_PREFIX=/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" >> $GITHUB_ENV
;;
"push")
Expand Down Expand Up @@ -127,15 +127,15 @@ jobs:
dotnet run --project src/docs-builder -- --strict --path-prefix "${PATH_PREFIX}"

- name: Build documentation
if: github.repository != 'elastic/docs-builder' && steps.deployment.outputs.result
if: github.repository != 'elastic/docs-builder' && (steps.deployment.outputs.result || (steps.check-files.outputs.any_changed == 'true' && github.event_name == 'merge_group'))
uses: elastic/docs-builder@main
continue-on-error: ${{ fromJSON(inputs.continue-on-error != '' && inputs.continue-on-error || 'false') }}
with:
prefix: ${{ env.PATH_PREFIX }}
strict: ${{ fromJSON(inputs.strict != '' && inputs.strict || 'true') }}

- uses: elastic/docs-builder/actions/validate-inbound-local@main
if: ${{ !cancelled() && steps.deployment.outputs.result }}
if: ${{ !cancelled() && (steps.deployment.outputs.result || (steps.check-files.outputs.any_changed == 'true' && github.event_name == 'merge_group')) }}

- uses: elastic/docs-builder/.github/actions/aws-auth@main
if: ${{ !cancelled() && steps.deployment.outputs.result }}
Expand Down