-
Notifications
You must be signed in to change notification settings - Fork 111
56 lines (53 loc) · 2.02 KB
/
playground.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
53
54
55
56
name: playground
on:
pull_request_target:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v1
with:
repository: 'teal-language/teal-playground'
ref: 'master'
path: 'tl/teal-playground'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install
run: |
cd ${{ github.workspace }}/teal-playground
yarn install
- name: build
run: |
cd ${{ github.workspace }}/teal-playground
yarn build
env:
VUE_APP_TL_PACKAGE_PATH_URL: https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.head_ref }}/?.lua
- name: netlify deploy
id: netlify-deploy
run: |
npm i -g netlify-cli
cd ${{ github.workspace }}/teal-playground
NETLIFY_URL=$(netlify deploy --dir=dist --alias=${{ github.event.pull_request.number }} | grep -Eo '(http|https)://[a-zA-Z0-9./?=_-]*(--)[a-zA-Z0-9./?=_-]*')
echo "$NETLIFY_URL"
echo "::set-output name=NETLIFY_URL::$NETLIFY_URL"
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_TEAL_PLAYGROUND_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TEAL_PLAYGROUND_TOKEN }}
- name: 'comment on pull-request'
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
const comments = await github.issues.listComments({ owner, repo, issue_number });
if (comments.data.filter(c => c.user.type === 'Bot').length > 0) {
console.log('Already commented. Playground url is unchanged.')
return
}
github.issues.createComment({ issue_number, owner, repo, body: 'Teal Playground URL: ${{ steps.netlify-deploy.outputs.NETLIFY_URL }}' });