Skip to content

Commit

Permalink
allow (isolated) build and push of preview image from forked PR
Browse files Browse the repository at this point in the history
  • Loading branch information
motoki317 committed Sep 17, 2023
1 parent 96440ab commit aa8cee6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: preview

on:
pull_request:
pull_request_target:

permissions:
packages: write
Expand All @@ -10,14 +10,17 @@ env:
IMAGE_NAME: traq-ui

jobs:
build-preview--image:
build-preview-image:
name: Build Preview Image
runs-on: ubuntu-latest
steps:
- name: Set PR_NUMBER env
run: echo "PR_NUMBER=$(echo $GITHUB_REF | sed -e 's/[^0-9]//g')" >> $GITHUB_ENV
run: echo "PR_NUMBER=${{ github.event.number }}" >> $GITHUB_ENV

- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -36,6 +39,7 @@ jobs:
username: traptitech
password: ${{ secrets.GITHUB_TOKEN }}

# 隔離された環境でビルドを行い、write perm付きトークンをユーザーのコードに与えないよう注意すること
- name: Build
uses: docker/build-push-action@v4
with:
Expand Down

0 comments on commit aa8cee6

Please sign in to comment.