From 00c48aa0ca52211805ee8dab17c4037293cb4bfb Mon Sep 17 00:00:00 2001 From: Sergio Ribera <56278796+SergioRibera@users.noreply.github.com> Date: Thu, 20 Jun 2024 02:26:30 -0400 Subject: [PATCH] ci: fix preview pr bad sha short --- .github/workflows/pr-preview.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 5a4181d..eceb0b5 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -44,10 +44,6 @@ jobs: submodules: "recursive" ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Declare some variables - shell: bash - run: | - echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" - name: Create comment id: comment @@ -75,7 +71,12 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy ./dist --project-name=rustmap --branch="${{ env.BRANCH_NAME }}" + command: pages deploy ./dist --project-name=rustmap --branch "${{ env.BRANCH_NAME }}" + + - name: Extract hash from CF url Deploy + run: | + url_hash=$(echo "${{ steps.deploy.outputs.deployment-url }}" | sed -n 's|https://\([^.]*\).rustmap.*|\1|p') + echo "SHA_SHORT=$url_hash" >> $GITHUB_ENV - name: Create comment uses: peter-evans/create-or-update-comment@v4