From ec46cead15c5ed258933642a0d800d192edc01f6 Mon Sep 17 00:00:00 2001 From: John Dunning Date: Thu, 28 Nov 2024 09:14:41 -0800 Subject: [PATCH] Update deploy.yml to run build on PRs Include Posthog API key as an env variable. --- .github/workflows/deploy.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b09fff2..777e652 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,8 @@ on: # Runs on pushes targeting the default branch push: branches: ["main"] + pull_request: + branches: ["main"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -22,7 +24,7 @@ concurrency: env: BUILD_PATH: "." # default value when not using subfolders - # BUILD_PATH: subfolder + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} jobs: build: @@ -62,6 +64,8 @@ jobs: - name: Install dependencies run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} working-directory: ${{ env.BUILD_PATH }} + - name: key + run: echo "${{ env.POSTHOG_API_KEY }}" - name: Build with Astro run: | ${{ steps.detect-package-manager.outputs.runner }} astro build \ @@ -74,6 +78,7 @@ jobs: path: ${{ env.BUILD_PATH }}/dist deploy: + if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}