commit 1e440746d439d2d5a764109ab7d79d8247538356
parent b3a3e97d1e7a5cd5705feb57144894c3e8ba3a1d
Author: MTRNord <mtrnord1@gmail.com>
Date: Mon, 18 Apr 2022 22:19:26 +0200
Fix preview workflow
Diffstat:
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml
@@ -1,17 +1,30 @@
-name: Build and Deploy
-permissions: read-all
+name: Build and Deploy Preview
+permissions:
+ actions: none
+ checks: none
+ contents: read
+ deployments: none
+ id-token: none
+ issues: none
+ discussions: none
+ packages: none
+ pages: none
+ pull-requests: write
+ repository-projects: none
+ security-events: none
+ statuses: none
on:
push:
branches:
- "main"
- pull_request:
+ pull_request_target:
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }}
runs-on: self-hosted
steps:
- name: Edit PR Description
- if: github.ref != 'refs/heads/main'
+ if: ${{ github.event.workflow_run.event == 'pull_request' }}
uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -20,15 +33,15 @@ jobs:
description-message: |
⌛ Deploy Preview - Build in Progress
- name: Checkout 🛎️
- if: github.ref != 'refs/heads/main'
+ if: ${{ github.event.workflow_run.event == 'pull_request' }}
uses: actions/checkout@v3
- name: Install and Build 🔧
- if: github.ref != 'refs/heads/main'
+ if: ${{ github.event.workflow_run.event == 'pull_request' }}
run: |
npm ci
npm run build
- name: Deploy to gh-pages
- if: github.ref != 'refs/heads/main'
+ if: ${{ github.event.workflow_run.event == 'pull_request' }}
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
@@ -36,7 +49,7 @@ jobs:
cname: preview.art.midnightthoughts.space
external_repository: MTRNord/matrix-art-preview
- name: Edit PR Description
- if: github.ref != 'refs/heads/main'
+ if: ${{ github.event.workflow_run.event == 'pull_request' }}
uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409
env:
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml
@@ -3,7 +3,7 @@ on:
push:
branches:
- "main"
- pull_request:
+ pull_request_target:
# Declare default permissions as read only.
permissions: read-all