1
- name : Build & test # on PRs (including forks) and push to develop/main
1
+ name : Build & test # on both PRs and push to develop/main
2
2
3
3
on :
4
4
pull_request_target :
10
10
build-and-test :
11
11
runs-on : ubuntu-latest
12
12
steps :
13
- # Get user permission of workflow triggering actor, return true or false
14
- - name : Get Workflow Actor Permission
15
- id : checkAccess
16
- # Action used: https://github.com/actions-cool/check-user-permission
17
- uses : actions-cool/check-user-permission@v2
18
- with :
19
- require : write
20
- username : ${{ github.triggering_actor }}
21
- env :
22
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23
- # Check user permission from previous step, exit if false
24
- - name : Check Workflow Actor Permission
25
- if : steps.checkAccess.outputs.require-result == 'false'
26
- run : |
27
- echo "${{ github.triggering_actor }} does not have permissions to run workflows on this repo."
28
- echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
29
- echo "Job originally triggered by ${{ github.actor }}"
30
- exit 1
31
- # Checkout PR code
32
- - name : Checkout code
33
- uses : actions/checkout@v4
34
- with :
35
- # This is dangerous without the first access check
36
- ref : ${{ github.event.pull_request.head.sha }}
13
+ - uses : actions/checkout@v4
37
14
- name : Get yarn cache directory path
38
15
id : yarn-cache-dir-path
39
16
run : echo "::set-output name=dir::$(yarn cache dir)"
@@ -48,11 +25,14 @@ jobs:
48
25
- name : Use NodeJs
49
26
uses : actions/setup-node@v3
50
27
with :
51
- node-version : " 20.x"
28
+ node-version : ' 20.x'
29
+
52
30
- name : Install dependencies
53
31
run : yarn install --frozen-lockfile --non-interactive
32
+
54
33
- name : Run linting
55
34
run : yarn lint
35
+
56
36
- name : Build app
57
37
run : yarn build
58
38
env :
0 commit comments