-
-
Notifications
You must be signed in to change notification settings - Fork 180
70 lines (61 loc) · 2.22 KB
/
autorun.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
name: Automatically crawl CVEs
on:
pull_request:
branches:
- master
workflow_dispatch:
branches:
- master
schedule:
- cron: '0 0/3 * * *'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# 当仓库隶属组织时,赋予流水线“写权限”以便提交变更
permissions:
contents: write
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
python -m pip install -r requirements.txt
- name: Crawl CVEs
run: |-
python main.py -g "${{ secrets.CRAWL_PWD }}" --gtk ${{ secrets.GRAPAQL_TOKEN }}
# 若该时间段没有 CVE, 则 file://cache/mail.dat 文件不会生成,此时不会发送邮件
# - name: Send mail
# if: ${{ secrets.CRAWL_PWD != '' && github.event_name != 'pull_request' }}
# uses: lyy289065406/action-send-mail@master
# with:
# server_address: ${{ secrets.MAIL_SMTP }}
# server_port: 465
# username: ${{ secrets.MAIL_USER }}
# password: ${{ secrets.MAIL_PASS }}
# from: ${{ secrets.MAIL_USER }}
# to: file://cache/mail_recvs.dat
# body: file://cache/mail_content.dat
# content_type: text/html
# subject: 威胁情报播报
# 如果不希望污染 commit 记录,user.email 和 user.name 随便填即可
# Github Runner 是有权限提交到仓库的,只要 user 不是 owner ,当次 commit 不会被记录
- name: Commit and push Github page (if changed)
if: ${{ github.event_name != 'pull_request' }}
run: |-
git diff
git config --global user.email "[email protected]"
git config --global user.name "Github-Bot"
git add -A
git commit -m "Updated by Github Bot" || exit 0
git push origin master