1
1
name : CI
2
2
3
- on : push
3
+ # on: push
4
+ on : [pull_request]
4
5
5
6
jobs :
6
7
build :
7
8
runs-on : ubuntu-latest
8
9
steps :
9
10
- uses : actions/checkout@v4
10
- - uses : jwalton/gh-find-current-pr@master
11
- id : findPr
12
- with :
13
- state : all
14
11
- uses : actions/setup-node@v3
15
12
with :
16
13
node-version-file : ' .nvmrc'
20
17
env :
21
18
ACCESS_REPO : ${{ github.repository }}
22
19
ACCESS_TOKEN : ${{ secrets.CI_TOKEN }}
23
- PR_NUMBER : ${{ steps.findPr.outputs.pr }}
20
+ PR_NUMBER : ${{ github.event.number }}
24
21
- uses : actions/cache@v3
25
22
with :
26
23
path : ./node_modules
35
32
run : yarn run site:build
36
33
- name : ' Deploy Site'
37
34
run : |
38
- export DEPLOY_DOMAIN=https://preview-${{ steps.findPr.outputs.pr }}-ng-alain-delon.surge.sh
35
+ export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-ng-alain-delon.surge.sh
39
36
echo "Deploy to $DEPLOY_DOMAIN"
40
37
cp ./src/dist/browser/index.html ./src/dist/browser/404.html
41
38
npx surge --project ./src/dist/browser --domain $DEPLOY_DOMAIN
@@ -46,19 +43,19 @@ jobs:
46
43
SURGE_TOKEN : ${{ secrets.SURGE_TOKEN }}
47
44
- name : ' Update comment on github'
48
45
run : |
49
- export DEPLOY_DOMAIN=https://preview-${{ steps.findPr.outputs.pr }}-ng-alain-delon.surge.sh
46
+ export DEPLOY_DOMAIN=https://preview-${{ github.event.number }}-ng-alain-delon.surge.sh
50
47
node ./scripts/github/comment.js "[Preview is ready!]($DEPLOY_DOMAIN)"
51
48
env :
52
49
ACCESS_REPO : ${{ github.repository }}
53
50
ACCESS_TOKEN : ${{ secrets.CI_TOKEN }}
54
- PR_NUMBER : ${{ steps.findPr.outputs.pr }}
51
+ PR_NUMBER : ${{ github.event.number }}
55
52
- name : ' When failed'
56
53
if : failure()
57
54
run : node ./scripts/github/comment.js "[Preview Build Failed!](https://github.com/ng-alain/delon/actions/runs/${{ github.run_id }})"
58
55
env :
59
56
ACCESS_REPO : ${{ github.repository }}
60
57
ACCESS_TOKEN : ${{ secrets.CI_TOKEN }}
61
- PR_NUMBER : ${{ steps.findPr.outputs.pr }}
58
+ PR_NUMBER : ${{ github.event.number }}
62
59
63
60
test :
64
61
runs-on : ubuntu-latest
0 commit comments