-
Notifications
You must be signed in to change notification settings - Fork 43
52 lines (45 loc) · 1.34 KB
/
epg.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
name: EPG
on:
schedule:
- cron: 59 * * * *
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: export xml-file
working-directory: xml
run: curl -ssL https://epg.112114.xyz/pp.xml -o e.xml
- name: check md5
run: |
md5=$(md5sum ./xml/e.xml | awk '{print $1}')
if ! grep -q "$md5" ./md5.txt; then
echo "isDiff=$md5" >> $GITHUB_ENV
fi
- name: xml to json
if: ${{ env.isDiff }}
run: |
pip3 install -r requirements.txt
python3 xml2json.py
- name: move file
if: ${{ env.isDiff }}
run: |
now_date=$(date -u -d '+8 hour' '+%Y-%m-%d')
cp -f ./xml/e.xml ./xml/e_$now_date.xml
mv -f ./json/e.json ./json/e_$now_date.json
echo "${{ env.isDiff }}" > ./md5.txt
- name: Commit
if: ${{ env.isDiff }}
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
sed "2c * 更新时间: $(date -u -d '+8 hour' '+%Y-%m-%d %H:%M:%S')" README.md -i
git add --all
git commit -m "update"
git push -f origin main