Skip to content

Commit 1d87f42

Browse files
authored
Update check.yml
1 parent 9c4d2c4 commit 1d87f42

1 file changed

Lines changed: 18 additions & 118 deletions

File tree

.github/workflows/check.yml

Lines changed: 18 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
name: NodeLoc Auto Checkin
1+
name: 检测Serv00开放注册
22

33
on:
44
schedule:
5-
# 每天UTC 8:00运行(北京时间16:00)
6-
- cron: '0 8 * * *'
5+
- cron: '0 23 * * *'
76
workflow_dispatch:
8-
# 支持手动触发
9-
7+
108
jobs:
11-
checkin:
9+
run-checker:
1210
runs-on: ubuntu-latest
1311

1412
steps:
@@ -18,122 +16,24 @@ jobs:
1816
- name: Set up Python
1917
uses: actions/setup-python@v5
2018
with:
21-
python-version: '3.10'
22-
cache: 'pip'
23-
24-
- name: Install system dependencies
25-
run: |
26-
sudo apt-get update
27-
sudo apt-get install -y \
28-
wget \
29-
curl \
30-
unzip \
31-
xvfb \
32-
libnss3 \
33-
libatk-bridge2.0-0 \
34-
libdrm2 \
35-
libxkbcommon0 \
36-
libxcomposite1 \
37-
libxdamage1 \
38-
libxrandr2 \
39-
libgbm1 \
40-
libatspi2.0-0 \
41-
libxshmfence1 \
42-
libasound2-plugins
43-
44-
- name: Install Chrome
45-
run: |
46-
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
47-
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
48-
sudo apt-get update
49-
# 安装最新稳定版 Chrome
50-
sudo apt-get install -y google-chrome-stable
51-
52-
- name: Verify Chrome installation
53-
run: google-chrome --version
19+
python-version: '3.9'
20+
5421

5522
- name: Install Python dependencies
5623
run: |
57-
pip install --upgrade pip
24+
python -m pip install --upgrade pip
5825
pip install -r requirements.txt
59-
60-
- name: Run NodeLoc Auto Checkin
61-
env:
62-
NL_COOKIE: ${{ secrets.NL_COOKIE }}
26+
27+
- name: Install Google Chrome
6328
run: |
64-
# 使用Xvfb在无头模式下运行Chrome
65-
Xvfb :99 -screen 0 1920x1080x24 &
66-
export DISPLAY=:99
67-
68-
# 运行签到脚本
69-
python main.py
70-
71-
- name: Upload log file
72-
if: always()
73-
uses: actions/upload-artifact@v4
74-
with:
75-
name: checkin-log
76-
path: checkin.log
77-
retention-days: 7
29+
30+
sudo apt-get update
31+
32+
sudo apt-get install -y google-chrome-stable
7833
79-
- name: Send Slack notification on failure
80-
if: failure()
81-
uses: 8398a7/action-slack@v3
82-
with:
83-
status: ${{ job.status }}
84-
text: 'NodeLoc 签到失败,请检查Cookie配置'
34+
- name: Run the checker script
35+
run: python checker.py
36+
8537
env:
86-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
87-
88-
- name: Send Bark notification
89-
if: always()
90-
run: |
91-
# 获取运行状态
92-
STATUS="${{ job.status }}"
93-
94-
# 构建消息内容
95-
if [ "$STATUS" = "success" ]; then
96-
TITLE="✅ NodeLoc 签到成功"
97-
BODY="所有账号签到完成,请查看日志"
98-
else
99-
TITLE="❌ NodeLoc 签到失败"
100-
BODY="签到过程中出现错误,请检查Cookie配置"
101-
fi
102-
103-
# 发送Bark通知(如果配置了BARK_KEY)
104-
if [ -n "${{ secrets.BARK_KEY }}" ]; then
105-
# 构建JSON数据
106-
JSON_DATA=$(jq -n \
107-
--arg title "$TITLE" \
108-
--arg body "$BODY" \
109-
'{
110-
"title": $title,
111-
"body": $body,
112-
"automaticallyCopy": true,
113-
"copy": $body
114-
}')
115-
116-
# 使用自建服务器或官方服务器
117-
if [ -n "${{ secrets.BARK_SERVER }}" ]; then
118-
# 自建服务器地址(例如:https://your-server.com)
119-
BARK_URL="${{ secrets.BARK_SERVER }}/${{ secrets.BARK_KEY }}"
120-
else
121-
# 官方服务器
122-
BARK_URL="https://api.day.app/${{ secrets.BARK_KEY }}"
123-
fi
124-
125-
# 发送通知
126-
echo "发送Bark通知到: $BARK_URL"
127-
echo "请求数据: $JSON_DATA"
128-
curl -s -w "\nHTTP状态码: %{http_code}\n" "$BARK_URL" \
129-
-H "Content-Type: application/json" \
130-
-d "$JSON_DATA" \
131-
-X POST
132-
if [ $? -eq 0 ]; then
133-
echo "Bark通知发送成功"
134-
else
135-
echo "Bark通知发送失败,但不影响主流程"
136-
fi
137-
else
138-
echo "未配置BARK_KEY,跳过Bark通知"
139-
fi
38+
BARK_KEY: ${{ secrets.BARK_KEY }}
39+
BARK_SERVER_URL: ${{ secrets.BARK_SERVER_URL }}

0 commit comments

Comments
 (0)