From 81f56f9f538c52191166a3c31a7f342aceac5917 Mon Sep 17 00:00:00 2001 From: Sander Devisscher Date: Mon, 26 Aug 2024 14:01:49 +0200 Subject: [PATCH] Update trigger_build_pkgdown_site.yaml --- .github/workflows/trigger_build_pkgdown_site.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/trigger_build_pkgdown_site.yaml b/.github/workflows/trigger_build_pkgdown_site.yaml index 47f20eb..34bb749 100644 --- a/.github/workflows/trigger_build_pkgdown_site.yaml +++ b/.github/workflows/trigger_build_pkgdown_site.yaml @@ -24,8 +24,16 @@ jobs: - name: Trigger Build pkgdown site run: | - # Extract the branch name from the full reference - BRANCH_NAME=${GITHUB_REF##*/} + # Determine the branch name based on the event type + if [[ "${{ github.event_name }}" == "workflow_run" ]]; then + # If triggered by a workflow_run, use the head_ref from the triggering workflow + BRANCH_NAME=${{ github.event.workflow_run.head_branch }} + else + # For other events, use the ref + BRANCH_NAME=${GITHUB_REF##*/} + fi + + echo "Triggering Build pkgdown site on branch: $BRANCH_NAME" gh workflow run "Build pkgdown site" --ref "$BRANCH_NAME" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}