Skip to content

Commit fc51e02

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

5 files changed

Lines changed: 38 additions & 41 deletions

File tree

.github/actions/publish-beta/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: 'Publish Beta Steps'
22
description: 'Steps to run when packages are not published (beta branch)'
3-
inputs:
43

54
runs:
65
using: 'composite'

.github/actions/setup/action.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
name: 'Setup Project'
22
description: 'Centralized setup for CI jobs'
33
inputs:
4-
fetch-depth:
5-
description: 'Git fetch depth'
6-
required: false
7-
default: '0'
8-
token:
9-
description: 'GitHub token'
10-
required: true
114
node-version-file:
125
description: 'Node version file'
136
required: false
@@ -16,14 +9,13 @@ inputs:
169
description: 'pnpm cache folder'
1710
required: false
1811
default: '.pnpm-store'
12+
CODECOV_TOKEN:
13+
description: 'CODECOV_TOKEN'
14+
required: true
15+
1916
runs:
2017
using: 'composite'
2118
steps:
22-
- uses: actions/checkout@v4
23-
with:
24-
fetch-depth: ${{ inputs.fetch-depth }}
25-
token: ${{ inputs.token }}
26-
2719
- uses: pnpm/action-setup@v4
2820
with:
2921
run_install: false
@@ -50,7 +42,7 @@ runs:
5042
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"
5143
shell: bash
5244
env:
53-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
45+
CODECOV_TOKEN: ${{ inputs.CODECOV_TOKEN }}
5446

5547
- name: Cache Playwright browsers
5648
uses: actions/cache@v4

.github/workflows/ci-fork.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
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:
@@ -20,26 +29,28 @@ jobs:
2029
run_install: false
2130

2231
- uses: actions/setup-node@v4
23-
id: cache
2432
with:
2533
node-version-file: '.node-version'
2634
cache: 'pnpm'
35+
cache-dependency-path: '**/pnpm-lock.yaml'
2736

2837
- run: pnpm install --frozen-lockfile
2938

30-
- name: Cache Playwright browsers
31-
uses: actions/cache@v4
39+
# Restore-only cache to avoid save attempts/noise on forks
40+
- name: Restore Playwright browsers cache
41+
uses: actions/cache/restore@v4
3242
with:
3343
path: ~/.cache/ms-playwright
3444
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
3545
restore-keys: |
3646
${{ runner.os }}-playwright-
3747
38-
- run: pnpm exec playwright install
48+
- run: pnpm exec playwright install --with-deps
3949

4050
- 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
51+
52+
# Needed so nx affected can diff against main
53+
- run: git branch --track main origin/main || true
4354

4455
- run: pnpm nx format:check
4556
- 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

.github/workflows/publish.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,16 @@ jobs:
4343
id-token: write
4444
runs-on: ubuntu-latest
4545
steps:
46-
- name: Setup Project
47-
uses: ./.github/actions/setup
46+
- uses: actions/checkout@v4
4847
with:
4948
fetch-depth: 0
5049
token: ${{ secrets.GH_TOKEN }}
5150

52-
- uses: actions/setup-node@v5
53-
id: cache
51+
- name: Setup Project
52+
uses: ./.github/actions/setup
5453
with:
55-
node-version-file: '.node-version'
56-
pnpm-cache-folder: .pnpm-store
57-
env:
54+
fetch-depth: 0
55+
token: ${{ secrets.GH_TOKEN }}
5856
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5957

6058
- name: publish
@@ -81,14 +79,6 @@ jobs:
8179
- name: Publish Beta Steps
8280
if: steps.changesets.outputs.published == 'false'
8381
uses: ./.github/actions/publish-beta
84-
with:
85-
branch: main
86-
87-
- uses: JamesIves/github-pages-deploy-action@v4.7.3
88-
with:
89-
folder: docs
90-
commit-message: 'chore: release-api-docs-beta'
91-
target-folder: 'beta'
9282

9383
- name: Calculate baseline bundle sizes
9484
run: |
@@ -118,6 +108,12 @@ jobs:
118108
env:
119109
HUSKY: 0
120110
steps:
111+
- uses: actions/checkout@v4
112+
with:
113+
fetch-depth: 0
114+
token: ${{ secrets.GH_TOKEN }}
115+
ref: ${{ inputs.branch }}
116+
121117
- name: Setup Project
122118
uses: ./.github/actions/setup
123119
with:

0 commit comments

Comments
 (0)