Skip to content

Commit 48b3321

Browse files
authored
Merge pull request #107 from patternfly/add_pr_previews
chore: add pr previews
2 parents 6e6db9d + f8471ff commit 48b3321

File tree

4 files changed

+58
-60
lines changed

4 files changed

+58
-60
lines changed

.github/workflows/build-lint-test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: build-lint-test
22
on:
33
workflow_call:
4+
inputs:
5+
pr-number:
6+
required: false
7+
type: string
48
jobs:
59
build:
610
runs-on: ubuntu-latest
711
env:
8-
GH_PR_NUM: ${{ github.event.number }}
12+
GH_PR_NUM: ${{ inputs.pr-number }}
913
steps:
1014
- uses: actions/checkout@v4
1115
- run: |
@@ -41,7 +45,7 @@ jobs:
4145
lint:
4246
runs-on: ubuntu-latest
4347
env:
44-
GH_PR_NUM: ${{ github.event.number }}
48+
GH_PR_NUM: ${{ inputs.pr-number }}
4549
needs: build
4650
steps:
4751
- uses: actions/checkout@v4
@@ -78,7 +82,7 @@ jobs:
7882
test_jest:
7983
runs-on: ubuntu-latest
8084
env:
81-
GH_PR_NUM: ${{ github.event.number }}
85+
GH_PR_NUM: ${{ inputs.pr-number }}
8286
needs: build
8387
steps:
8488
- uses: actions/checkout@v4
@@ -120,7 +124,7 @@ jobs:
120124
test_a11y:
121125
runs-on: ubuntu-latest
122126
env:
123-
GH_PR_NUM: ${{ github.event.number }}
127+
GH_PR_NUM: ${{ inputs.pr-number }}
124128
needs: build
125129
steps:
126130
- uses: actions/checkout@v4

.github/workflows/build.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/check-pr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ on:
66
jobs:
77
call-build-lint-test-workflow:
88
uses: ./.github/workflows/build-lint-test.yml
9+
secrets: inherit
10+
with:
11+
pr-number: ${{ github.event.number }}

.github/workflows/pr-preview.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: pr-preview
2+
on:
3+
pull_request_target:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
check-permissions:
9+
uses: patternfly/.github/.github/workflows/check-team-membership.yml@main
10+
secrets: inherit
11+
12+
deploy-preview:
13+
runs-on: ubuntu-latest
14+
needs: check-permissions
15+
if: needs.check-permissions.outputs.allowed == 'true'
16+
env:
17+
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
18+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
19+
GH_PR_TOKEN: ${{ secrets.GH_PR_TOKEN }}
20+
GH_PR_NUM: ${{ needs.check-permissions.outputs.pr-number }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
- run: |
24+
git fetch origin pull/$GH_PR_NUM/head:tmp
25+
git checkout tmp
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version-file: '.nvmrc'
29+
- run: corepack enable
30+
- uses: actions/cache@v4
31+
id: yarn-cache
32+
name: Cache yarn deps
33+
with:
34+
path: |
35+
node_modules
36+
**/node_modules
37+
key: ${{ runner.os }}-yarn-22-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
38+
- run: yarn install --immutable
39+
if: steps.yarn-cache.outputs.cache-hit != 'true'
40+
- run: yarn build
41+
name: Build
42+
- run: yarn build:docs
43+
name: Build docs
44+
- name: Upload docs
45+
uses: patternfly/.github/.github/actions/surge-preview@main
46+
with:
47+
folder: packages/module/public

0 commit comments

Comments
 (0)