From 739be6bbef7961255ad32a8bb1d9aa8a1d9834d2 Mon Sep 17 00:00:00 2001 From: Jeremy McCormick Date: Fri, 25 Oct 2024 12:00:35 -0500 Subject: [PATCH] Include the fork name when building versioned site --- .github/workflows/deploy_version.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_version.yaml b/.github/workflows/deploy_version.yaml index 9c364bb..646ff90 100644 --- a/.github/workflows/deploy_version.yaml +++ b/.github/workflows/deploy_version.yaml @@ -12,9 +12,17 @@ jobs: - name: Extract branch name shell: bash - run: echo "BRANCH_NAME=$(echo ${{ github.head_ref }} | sed 's/\//-/g')" >> $GITHUB_ENV + run: | + if [ "${{ github.event.pull_request.head.repo.fork }}" = "true" ]; then + FORK_NAME="${{ github.event.pull_request.head.repo.full_name }}" + BRANCH_NAME="${FORK_NAME}/$(echo ${{ github.head_ref }})" + else + BRANCH_NAME=$(echo ${{ github.head_ref }}) + fi + BRANCH_NAME=$(echo $BRANCH_NAME | sed 's/\//-/g') + echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV - - name: Debug print branch name + - name: Print branch name shell: bash run: echo "BRANCH_NAME=${{ env.BRANCH_NAME }}"