Skip to content

Commit d70f120

Browse files
committed
feat(workflow): 新增钉钉推送工作流
1 parent 67cbe17 commit d70f120

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

.github/workflows/dingding_push.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
YEAR=${{ steps.date.outputs.year }}
2828
MONTH=${{ steps.date.outputs.month }}
2929
30-
# 根据 daily_report.yml 的目录结构查找今天的报告
31-
report_file="reports/$YEAR/$MONTH/$DATE.md"
30+
# 从 data 目录查找今天的 JSON 报告
31+
report_file="data/$YEAR/$MONTH/$DATE.json"
3232
3333
if [ -f "$report_file" ]; then
3434
echo "report_file=$report_file" >> $GITHUB_OUTPUT
3535
echo "找到今日报告: $report_file"
3636
else
3737
# 如果没有今天的报告,查找最新的报告
38-
latest_file=$(find reports -type f -name "*.md" | sort -r | head -n 1)
38+
latest_file=$(find data -type f -name "*.json" | sort -r | head -n 1)
3939
if [ -z "$latest_file" ]; then
4040
echo "未找到报告文件"
4141
exit 1
@@ -58,7 +58,7 @@ jobs:
5858
exit 0
5959
fi
6060
61-
python3 - <<'PY'
61+
python3 - <<'PY'
6262
import json, os
6363
6464
report_file = os.environ['REPORT_FILE']
@@ -95,13 +95,10 @@ jobs:
9595
)
9696
}
9797
}
98-
print("发送消息内容:")
99-
print(json.dumps(message, ensure_ascii=False, indent=2))
98+
print(json.dumps(message))
10099
101-
with open('dingtalk_message.json', 'w', encoding='utf-8') as f:
102-
json.dump(message, f, ensure_ascii=False)
103-
PY
104100
101+
PY
105102
# curl "https://oapi.dingtalk.com/robot/send?access_token=$DINGDING_TOKEN" \
106103
# -H 'Content-Type: application/json' \
107104
# -d @dingtalk_message.json

0 commit comments

Comments
 (0)