forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (99 loc) · 3.27 KB
/
issue-command.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Issue Command
on:
issue_comment:
types: [created]
permissions:
contents: read
jobs:
rebase:
name: Automatic Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && github.event.comment.author_association == 'COLLABORATOR'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_SUPER }}
self-assign:
name: Self Assign
if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, '/wip') }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write
steps:
- uses: bhermann/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
assign_phrase: '/wip'
label_phase1: RSS proposal
label_phase2: RSS bug
test-on-demand:
name: Test route on demand
if: startsWith(github.event.comment.body, '/test')
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js v18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies (yarn)
run: yarn
- name: Fetch affected routes
id: fetchRoute
uses: actions/github-script@v6
env:
EVENT: ${{ toJson(github.event) }}
with:
script: |
const event = JSON.parse(process.env.EVENT)
const body = event.comment.body
const number = event.issue.number
const sender = event.comment.user.login
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/identify.js`)
return await script({ github, context, core }, body, number, sender)
- name: Start RSSHub
if: env.TEST_CONTINUE
run: yarn start &
env:
NODE_ENV: dev
LOGGER_LEVEL: debug
- name: Generate feedback
if: env.TEST_CONTINUE
uses: actions/github-script@v6
env:
TEST_BASEURL: http://localhost:1200
TEST_ROUTES: ${{ steps.fetchRoute.outputs.result }}
EVENT: ${{ toJson(github.event) }}
with:
script: |
const event = JSON.parse(process.env.EVENT)
const link = process.env.TEST_BASEURL
const routes = JSON.parse(process.env.TEST_ROUTES)
const number = event.issue.number
core.info(`${link}, ${routes}, ${number}`)
const got = require("got")
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/test.js`)
return await script({ github, context, core, got }, link, routes, number)
- name: Print logs
if: (env.TEST_CONTINUE)
run: cat ${{ github.workspace }}/logs/combined.log
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: logs
path: logs
retention-days: 1