@@ -147,11 +147,14 @@ if [ -n "$INIT" ]; then
147
147
cp -n antora-playbook.preview.local.yml-example antora-playbook.preview.local.yml \
148
148
|| echo " antora-playbook.preview.local.yml already exists"
149
149
150
- echo " 🐇 Linking 'preview' command (you may need to enter your password)"
150
+ echo " 🐇 Checking 'preview' command link (you may need to enter your password)"
151
151
152
- sudo ln -sf $( realpath $0 ) /usr/local/bin/preview
152
+ which preview || sudo ln -sf $( realpath $0 ) /usr/local/bin/preview
153
153
which preview > /dev/null || ( echo " Failed to link preview command" ; exit 1 )
154
154
155
+ brew install gh jq yq
156
+ gh auth token || gh auth login
157
+
155
158
echo " 🐇 initialised preview script"
156
159
exit 0
157
160
fi
@@ -181,6 +184,7 @@ export PREVIEW_REPO=$(basename $TOPLEVEL)
181
184
export PREVIEW_BRANCH=$( git branch --show-current)
182
185
export PREVIEW_START_PATH=.${ANTORA# $TOPLEVEL }
183
186
export PREVIEW_CONFIG=${PREVIEW_CONFIG:- $PREVIEW_BRANCH }
187
+ export PREVIEW_COMPONENT=$( yq .name $ANTORA /antora.yml 2> /dev/null)
184
188
185
189
if [ -z " $REMOTE " ]; then
186
190
export PREVIEW_OVERRIDE=${PREVIEW_OVERRIDE:- antora-playbook.preview.local.yml}
@@ -214,6 +218,8 @@ if [ -n "$REMOTE" ]; then
214
218
215
219
PR_BASE_OID=$( gh pr view --json baseRefOid -q .baseRefOid 2> /dev/null) || true
216
220
PR_BASE_NAME=$( gh pr view --json baseRefName -q .baseRefName 2> /dev/null) || true
221
+ PR_NUMBER=$( gh pr view --json number -q .number 2> /dev/null) || true
222
+ PREVIEW_OWNER=$( gh repo view --json owner -q .owner.login) || true
217
223
218
224
WORKFLOW=preview-deploy.yml
219
225
UUID=$( uuidgen)
@@ -223,9 +229,11 @@ if [ -n "$REMOTE" ]; then
223
229
--field preview_branch=${PREVIEW_BRANCH} \
224
230
--field preview_start_path=${PREVIEW_START_PATH} \
225
231
--field preview_override=${PREVIEW_OVERRIDE} \
226
- --field pr_base_name=${PR_BASE_NAME} \
227
232
--field pr_base_oid=${PR_BASE_OID} \
233
+ --field preview_owner=${PREVIEW_OWNER} \
234
+ --field pr_number=${PR_NUMBER} \
228
235
--field uuid=${UUID} \
236
+ --field preview_component=${PREVIEW_COMPONENT} \
229
237
> /dev/null
230
238
231
239
echo Requested the build at Github with UUID $UUID
0 commit comments