@@ -36,36 +36,36 @@ jobs:
36
36
build :
37
37
concurrency :
38
38
group : ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref }}
39
- cancel-in-progress : ${{ github.event_name == 'pull_request_target' }}
39
+ cancel-in-progress : ${{ startsWith( github.event_name, 'pull_request') }}
40
40
runs-on : ubuntu-latest
41
41
steps :
42
42
43
+ - name : Checkout
44
+ uses : actions/checkout@v4
45
+ with :
46
+ ref : ${{ github.event.pull_request.head.sha || github.ref }}
47
+ persist-credentials : false
48
+
43
49
- name : Get changed files
44
- if : github.event_name == 'pull_request_target '
50
+ if : startsWith( github.event_name, 'pull_request') || github.event_name == 'merge_group '
45
51
id : check-files
46
52
uses : tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
47
53
with :
48
54
files : ${{ inputs.path-pattern != '' && inputs.path-pattern || '**' }}
49
55
50
56
- name : Free Disk Space
57
+ if : github.event_name != 'merge_group'
51
58
uses : jlumbroso/free-disk-space@main
52
59
with :
53
60
tool-cache : false
54
-
55
- - name : Checkout
56
- if : github.event_name == 'push' || steps.check-files.outputs.any_changed == 'true'
57
- uses : actions/checkout@v4
58
- with :
59
- ref : ${{ github.event.pull_request.head.sha || github.ref }}
60
- persist-credentials : false
61
-
61
+
62
62
- name : Create Deployment
63
- if : github.event_name == 'push' || steps.check-files.outputs.any_changed == 'true'
63
+ if : github.event_name == 'push' || ( steps.check-files.outputs.any_changed == 'true' && startsWith(github.event_name, 'pull_request'))
64
64
uses : actions/github-script@v7
65
65
id : deployment
66
66
env :
67
67
PR_NUMBER : ${{ github.event.pull_request.number }}
68
- REF : ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref_name }}
68
+ REF : ${{ startsWith( github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.ref_name }}
69
69
with :
70
70
result-encoding : string
71
71
script : |
99
99
GITHUB_REF_NAME : ${{ github.ref_name }}
100
100
run : |
101
101
case "${GITHUB_EVENT_NAME}" in
102
- "pull_request_target")
102
+ "merge_group" | "pull_request" | " pull_request_target")
103
103
echo "PATH_PREFIX=/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" >> $GITHUB_ENV
104
104
;;
105
105
"push")
@@ -127,15 +127,15 @@ jobs:
127
127
dotnet run --project src/docs-builder -- --strict --path-prefix "${PATH_PREFIX}"
128
128
129
129
- name : Build documentation
130
- if : github.repository != 'elastic/docs-builder' && steps.deployment.outputs.result
130
+ if : github.repository != 'elastic/docs-builder' && ( steps.deployment.outputs.result || (steps.check-files.outputs.any_changed == 'true' && github.event_name == 'merge_group'))
131
131
uses : elastic/docs-builder@main
132
132
continue-on-error : ${{ fromJSON(inputs.continue-on-error != '' && inputs.continue-on-error || 'false') }}
133
133
with :
134
134
prefix : ${{ env.PATH_PREFIX }}
135
135
strict : ${{ fromJSON(inputs.strict != '' && inputs.strict || 'true') }}
136
136
137
137
- uses : elastic/docs-builder/actions/validate-inbound-local@main
138
- if : ${{ !cancelled() && steps.deployment.outputs.result }}
138
+ if : ${{ !cancelled() && ( steps.deployment.outputs.result || (steps.check-files.outputs.any_changed == 'true' && github.event_name == 'merge_group')) }}
139
139
140
140
- uses : elastic/docs-builder/.github/actions/aws-auth@main
141
141
if : ${{ !cancelled() && steps.deployment.outputs.result }}
0 commit comments