-
Notifications
You must be signed in to change notification settings - Fork 13
52 lines (45 loc) · 1.92 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Install and build
on:
workflow_call:
jobs:
install-build:
name: Install and build
runs-on: ubuntu-latest
steps:
- name: Check if contributor is an org member
id: is_organization_member
if: github.event_name == 'pull_request_target'
uses: JamesSingleton/[email protected]
with:
organization: ramp4-pcar4
username: ${{ github.event.pull_request.head.user.login }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Output comment and end build if not org member
if: github.event_name == 'pull_request_target'
run: |
result=${{ steps.is_organization_member.outputs.result }}
if [ $result == false ]; then
user=${{ github.event.pull_request.head.user.login }}
echo Either ${user} is not part of the ramp4-pcar4 organization
echo or ${user} has its Organization Visibility set to Private at
echo https://github.com/orgs/ramp4-pcar4/people?query=${user}
exit 1
fi
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- name: Setup Node version
uses: actions/setup-node@v3
with:
node-version: 16.16.0
- name: Install and build
run: |
npm ci
npm run build
- name: Cache dist files
uses: actions/cache@v3
with:
path: dist
key: dist-${{ github.event.pull_request.head.sha || github.sha }}