diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index d8aa4dd7..716ac6bf 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -1,4 +1,4 @@ -name: Deploy docs website to GitHub Pages +name: Generate docs website to GitHub Pages on: push: @@ -7,13 +7,19 @@ on: paths: - '.github/workflows/deploy-docs.yaml' - 'website/**' + pull_request: + branches: + - main + paths: + - '.github/workflows/deploy-docs.yaml' + - 'website/**' permissions: contents: read jobs: deploy: - name: Deploy docs website to GitHub Pages + name: Generate docs website to GitHub Pages runs-on: ubuntu-latest permissions: contents: write @@ -48,10 +54,11 @@ jobs: - run: yarn install --frozen-lockfile - run: yarn build + # deploy only after PR is merged to main - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && github.repository == 'project-copacetic/copacetic' uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 - if: ${{ github.ref == 'refs/heads/main' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/build - destination_dir: ./website \ No newline at end of file + destination_dir: ./website