ci: use pull_request_target with authorization hook where required

This commit is contained in:
Abdullah Atta
2025-07-21 11:26:03 +05:00
parent 23ee50f688
commit 40c69d7cba
2 changed files with 21 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ on:
- "packages/core/**" - "packages/core/**"
# re-run workflow if workflow file changes # re-run workflow if workflow file changes
- ".github/workflows/core.tests.yml" - ".github/workflows/core.tests.yml"
pull_request: pull_request_target:
branches: branches:
- "master" - "master"
paths: paths:
@@ -23,9 +23,17 @@ on:
- "reopened" - "reopened"
jobs: jobs:
test: authorize:
runs-on: ubuntu-22.04 environment: ${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: echo true
test:
needs: authorize
runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@@ -9,7 +9,7 @@ on:
- "apps/web/**" - "apps/web/**"
# re-run workflow if workflow file changes # re-run workflow if workflow file changes
- ".github/workflows/web.tests.yml" - ".github/workflows/web.tests.yml"
pull_request: pull_request_target:
branches: branches:
- "master" - "master"
paths: paths:
@@ -23,7 +23,16 @@ on:
- "reopened" - "reopened"
jobs: jobs:
authorize:
environment: ${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: echo true
build: build:
needs: authorize
name: Build name: Build
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps: