Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@ name: CI

on:
pull_request:
pull_request_target:
# Run on release-please PRs (created by GITHUB_TOKEN which doesn't trigger regular pull_request)
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
format:
runs-on: ubuntu-latest
# Only run from pull_request_target if it's a release-please branch, otherwise skip (to avoid duplicate runs)
if: github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && startsWith(github.event.pull_request.head.ref, 'release-please--')) || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# For pull_request_target, explicitly checkout the PR head
ref: ${{ github.event.pull_request.head.sha }}
# Only checkout PR code if it's from the same repo (safe for release-please)
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -25,9 +35,16 @@ jobs:

lint:
runs-on: ubuntu-latest
# Only run from pull_request_target if it's a release-please branch, otherwise skip (to avoid duplicate runs)
if: github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && startsWith(github.event.pull_request.head.ref, 'release-please--')) || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# For pull_request_target, explicitly checkout the PR head
ref: ${{ github.event.pull_request.head.sha }}
# Only checkout PR code if it's from the same repo (safe for release-please)
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -43,9 +60,16 @@ jobs:

build:
runs-on: ubuntu-latest
# Only run from pull_request_target if it's a release-please branch, otherwise skip (to avoid duplicate runs)
if: github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && startsWith(github.event.pull_request.head.ref, 'release-please--')) || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# For pull_request_target, explicitly checkout the PR head
ref: ${{ github.event.pull_request.head.sha }}
# Only checkout PR code if it's from the same repo (safe for release-please)
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -62,9 +86,16 @@ jobs:
test:
runs-on: ubuntu-latest
needs: build
# Only run from pull_request_target if it's a release-please branch, otherwise skip (to avoid duplicate runs)
if: github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && startsWith(github.event.pull_request.head.ref, 'release-please--')) || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# For pull_request_target, explicitly checkout the PR head
ref: ${{ github.event.pull_request.head.sha }}
# Only checkout PR code if it's from the same repo (safe for release-please)
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -89,7 +120,8 @@ jobs:
ready-to-merge:
runs-on: ubuntu-latest
needs: [format, lint, build, test]
if: always()
# Only run from pull_request_target if it's a release-please branch, otherwise skip (to avoid duplicate runs)
if: always() && (github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && startsWith(github.event.pull_request.head.ref, 'release-please--')) || github.event_name == 'workflow_dispatch')
steps:
- name: Check all jobs passed
run: |
Expand Down
Loading