Skip to content

Commit f8e59c5

Browse files
committed
test
1 parent 77cfddd commit f8e59c5

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

.github/workflows/preview.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
name: preview
22

33
on:
4-
workflow_call: ~
4+
workflow_call:
5+
inputs:
6+
strict:
7+
type: boolean
8+
default: true
59

610
permissions:
711
id-token: write
@@ -24,7 +28,7 @@ jobs:
2428
owner,
2529
repo,
2630
ref: context.payload.pull_request.head.ref,
27-
environment: `preview-${context.issue.number}`,
31+
environment: `docs-preview-${context.issue.number}`,
2832
description: `Preview deployment for PR ${context.issue.number}`,
2933
auto_merge: false,
3034
required_contexts: [],
@@ -42,19 +46,33 @@ jobs:
4246
- uses: actions/checkout@v4
4347

4448
- uses: actions/download-artifact@v4
49+
if: github.repository == 'elastic/docs-builder'
4550
with:
4651
name: docs-builder-binary
4752

4853
# we run our artifact directly please use the prebuild
4954
# elastic/docs-builder@main GitHub Action for all other repositories!
5055
- name: Build documentation
56+
if: github.repository == 'elastic/docs-builder'
5157
env:
52-
PR_NUMBER: ${{ github.event.pull_request.number }}
58+
PR_NUMBER:
5359
run: |
5460
chmod +x ./docs-builder
55-
./docs-builder --strict --path-prefix "/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}"
61+
./docs-builder --strict --path-prefix "/${GITHUB_REPOSITORY}/pull/${{ github.event.pull_request.number }}"
62+
63+
- name: Build documentation
64+
if: github.repository != 'elastic/docs-builder'
65+
run: |
66+
echo "Building documentation for ${GITHUB_REPOSITORY}"
67+
- name: Build public documentation
68+
if: github.repository != 'elastic/docs-builder'
69+
uses: elastic/docs-builder@main
70+
continue-on-error: ${{ inputs.strict != 'true' }} # Will be removed after the migration phase
71+
with:
72+
prefix: "/${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
73+
strict: ${{ inputs.strict }}
5674

57-
- uses: ./.github/actions/aws-auth
75+
- uses: elastic/docs-builder/.github/actions/aws-auth@main
5876

5977
- name: Upload to S3
6078
env:

actions/preview/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ runs:
2121
if [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.action }}" == "closed" ]]; then
2222
echo "IS_CLEANUP=true" >> $GITHUB_OUTPUT
2323
echo "IS_DEPLOYMENT=false" >> $GITHUB_OUTPUT
24-
elif [[ ${{ github.event_name }} == 'pull_request' || "${{ github.ref }}" == 'refs/heads/main' ]]; then
24+
elif [[ ${{ github.event_name }} == 'pull_request' || ("${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/heads/main') ]]; then
2525
echo "IS_CLEANUP=false" >> $GITHUB_OUTPUT
2626
echo "IS_DEPLOYMENT=true" >> $GITHUB_OUTPUT
2727
fi
@@ -118,7 +118,7 @@ runs:
118118
if [[ -n "${{ github.event.pull_request }}" ]]; then
119119
echo "result=/${GITHUB_REPOSITORY}/pull/${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
120120
else
121-
echo "result=/${GITHUB_REPOSITORY}/${{ github.ref_name }}" >> $GITHUB_OUTPUT
121+
echo "result=/${GITHUB_REPOSITORY}/tree/${{ github.ref_name }}" >> $GITHUB_OUTPUT
122122
fi
123123
124124
- name: Build public documentation

0 commit comments

Comments
 (0)