Skip to content

Commit 83daf4f

Browse files
committed
update workflow variables used
1 parent d144a61 commit 83daf4f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scripts/preview

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,14 @@ if [ -n "$INIT" ]; then
147147
cp -n antora-playbook.preview.local.yml-example antora-playbook.preview.local.yml \
148148
|| echo "antora-playbook.preview.local.yml already exists"
149149

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)"
151151

152-
sudo ln -sf $(realpath $0) /usr/local/bin/preview
152+
which preview || sudo ln -sf $(realpath $0) /usr/local/bin/preview
153153
which preview >/dev/null || ( echo "Failed to link preview command"; exit 1 )
154154

155+
brew install gh jq yq
156+
gh auth token || gh auth login
157+
155158
echo "🐇 initialised preview script"
156159
exit 0
157160
fi
@@ -181,6 +184,7 @@ export PREVIEW_REPO=$(basename $TOPLEVEL)
181184
export PREVIEW_BRANCH=$(git branch --show-current)
182185
export PREVIEW_START_PATH=.${ANTORA#$TOPLEVEL}
183186
export PREVIEW_CONFIG=${PREVIEW_CONFIG:-$PREVIEW_BRANCH}
187+
export PREVIEW_COMPONENT=$(yq .name $ANTORA/antora.yml 2>/dev/null)
184188

185189
if [ -z "$REMOTE" ]; then
186190
export PREVIEW_OVERRIDE=${PREVIEW_OVERRIDE:-antora-playbook.preview.local.yml}
@@ -214,6 +218,8 @@ if [ -n "$REMOTE" ]; then
214218

215219
PR_BASE_OID=$(gh pr view --json baseRefOid -q .baseRefOid 2>/dev/null) || true
216220
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
217223

218224
WORKFLOW=preview-deploy.yml
219225
UUID=$(uuidgen)
@@ -223,9 +229,11 @@ if [ -n "$REMOTE" ]; then
223229
--field preview_branch=${PREVIEW_BRANCH} \
224230
--field preview_start_path=${PREVIEW_START_PATH} \
225231
--field preview_override=${PREVIEW_OVERRIDE} \
226-
--field pr_base_name=${PR_BASE_NAME} \
227232
--field pr_base_oid=${PR_BASE_OID} \
233+
--field preview_owner=${PREVIEW_OWNER} \
234+
--field pr_number=${PR_NUMBER} \
228235
--field uuid=${UUID} \
236+
--field preview_component=${PREVIEW_COMPONENT} \
229237
> /dev/null
230238

231239
echo Requested the build at Github with UUID $UUID

0 commit comments

Comments
 (0)