Skip to content

Commit 4a81119

Browse files
committed
chore: update-fork-flow
1 parent fbf3a49 commit 4a81119

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

.github/workflows/ci-fork.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
name: ForgeRock Fork Pull Request CI
2+
23
on:
3-
pull_request_target:
4-
types: [opened, synchronize, reopened]
5-
branches:
6-
- main
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
actions: read
9+
10+
concurrency:
11+
group: pr-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
713

814
jobs:
915
pr:
16+
# Only run for forks
17+
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
1018
runs-on: ubuntu-latest
1119
timeout-minutes: 20
20+
1221
steps:
1322
- uses: actions/checkout@v4
1423
with:
24+
# head commit is fine; the default merge ref also works on pull_request
1525
ref: ${{ github.event.pull_request.head.sha }}
1626
fetch-depth: 0
1727

@@ -20,26 +30,28 @@ jobs:
2030
run_install: false
2131

2232
- uses: actions/setup-node@v4
23-
id: cache
2433
with:
2534
node-version-file: '.node-version'
2635
cache: 'pnpm'
36+
cache-dependency-path: '**/pnpm-lock.yaml'
2737

2838
- run: pnpm install --frozen-lockfile
2939

30-
- name: Cache Playwright browsers
31-
uses: actions/cache@v4
40+
# Restore-only cache to avoid save attempts/noise on forks
41+
- name: Restore Playwright browsers cache
42+
uses: actions/cache/restore@v4
3243
with:
3344
path: ~/.cache/ms-playwright
3445
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
3546
restore-keys: |
3647
${{ runner.os }}-playwright-
3748
38-
- run: pnpm exec playwright install
49+
- run: pnpm exec playwright install --with-deps
3950

4051
- uses: nrwl/nx-set-shas@v4
41-
# This line is needed for nx affected to work when CI is running on a PR
42-
- run: git branch --track main origin/main
52+
53+
# Needed so nx affected can diff against main
54+
- run: git branch --track main origin/main || true
4355

4456
- run: pnpm nx format:check
4557
- run: pnpm nx affected -t build typecheck lint test e2e-ci

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ concurrency:
1616

1717
jobs:
1818
pr:
19+
if: ${{github.event.pull_request.head.repo.full_name == github.repository}}
1920
runs-on: ubuntu-latest
2021
timeout-minutes: 20
2122
permissions:
@@ -37,8 +38,6 @@ jobs:
3738

3839
- run: pnpm install --frozen-lockfile
3940

40-
# This line enables distribution
41-
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
4241
- run: pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"
4342
- run: pnpm nx sync:check
4443

0 commit comments

Comments
 (0)