forked from EXP-Tools/threat-broadcast
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 1.94 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
name: Automatically crawl CVEs
on:
pull_request:
branches:
- master
workflow_dispatch:
branches:
- master
schedule:
- cron: '15 * * * *'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
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 -gtk ${{ secrets.GRAPAQL_TOKEN }}
# 若该时间段没有 CVE, 则 file://cache/mail.dat 文件不会生成,此时不会发送邮件
- name: Send mail
if: ${{ 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