forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (44 loc) · 1.8 KB
/
pr-deploy-route-test.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
name: PR route test
# https://github.com/actions/first-interaction/issues/10#issuecomment-670968624
# https://github.com/actions/first-interaction/issues/10#issuecomment-752360668
# Reopen Included
on:
- pull_request_target
jobs:
testRoute:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch affected routes
id: fetchRoute
uses: actions/github-script@v3
with:
# by default, JSON format returned
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const body = context.payload.pull_request.body
const number = context.payload.pull_request.number
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/identify.js`)
return await script({github, context, core}, body, number)
- name: Waiting for 200 from the Vercel Preview
if: (env.TEST_CONTINUE)
uses: patrickedqvist/wait-for-vercel-preview@master
id: waitFor200
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 300
- name: Generate feedback
if: (env.TEST_CONTINUE)
uses: actions/github-script@v3
env:
TEST_BASEURL: ${{steps.waitFor200.outputs.url}}
TEST_ROUTES: ${{ steps.fetchRoute.outputs.result }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const link = process.env.TEST_BASEURL
const routes = JSON.parse(process.env.TEST_ROUTES)
const number = context.payload.pull_request.number
core.info(`${link}, ${routes}, ${number}`)
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/test.js`)
return await script({github, context, core}, link, routes, number)