diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 28aeece..60899e4 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -39,11 +39,19 @@ jobs: - name: Remove artifact zip run: rm hugo.zip + #Extracting and deployment workflow copied from https://github.com/gpuweb/gpuweb/blob/main/.github/workflows/preview-pull-request.yml + - name: Find PR + if: ${{ github.event.workflow_run.event == 'pull_request' }} + run: | + PR=$(curl https://api.github.com/search/issues?q=${{ github.event.workflow_run.head_sha }} | + grep -Po "(?<=${{ github.event.workflow_run.repository.full_name }}\/pulls\/)\d*" | head -1) + echo "PR=$PR" >> $GITHUB_ENV + - name: Deploy to Firebase uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PRIVSEC_356523 }}' projectId: privsec-356523 - channelID: '$(cat .PR)' + channelId: prs-${{ env.PR }}-${{ github.event.workflow_run.head_sha }} expires: 30d \ No newline at end of file diff --git a/.github/workflows/pull-request-receiver.yml b/.github/workflows/pull-request-receiver.yml index 35eb6d6..81f1b9b 100644 --- a/.github/workflows/pull-request-receiver.yml +++ b/.github/workflows/pull-request-receiver.yml @@ -23,11 +23,6 @@ jobs: - name: Build Hugo site run: hugo --minify - - - name: Save PR number - run: | - mkdir -p ./pr - echo ${{ github.event.number }} > .PR - name: Upload artifact uses: actions/upload-artifact@v2