# Introduction Using changed-files from a forked repo with `pull_request_target` results in invalid checkout issue Used the native paths GitHub Actions syntax to handle workflow triggering [Paths syntax](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore)
37 lines
1.4 KiB
YAML
37 lines
1.4 KiB
YAML
name: 'Preview Environment Dispatch'
|
|
|
|
on:
|
|
# Using pull_request_target instead of pull_request to have access to secrets for external contributors
|
|
# Security note: This is safe because we're only using the repository-dispatch action with limited scope
|
|
# and not checking out or running any code from the external contributor's PR
|
|
pull_request_target:
|
|
types: [opened, synchronize, reopened, labeled]
|
|
paths:
|
|
- packages/twenty-docker/**
|
|
- packages/twenty-server/**
|
|
- packages/twenty-front/**
|
|
- .github/workflows/preview-env-dispatch.yaml
|
|
- .github/workflows/preview-env-keepalive.yaml
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
trigger-preview:
|
|
permissions:
|
|
contents: write
|
|
actions: write
|
|
pull-requests: read
|
|
if: contains(github.event.pull_request.labels.*.name, 'preview')
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Trigger preview environment workflow
|
|
uses: peter-evans/repository-dispatch@v2
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
repository: ${{ github.repository }}
|
|
event-type: preview-environment
|
|
client-payload: '{"pr_number": "${{ github.event.pull_request.number }}", "pr_head_sha": "${{ github.event.pull_request.head.sha }}", "repo_full_name": "${{ github.repository }}"}'
|