feat: 支持飞书投稿每日一问并自动同步 - #41
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #39
改动说明
为现有“每日一问”增加飞书投稿和自动入库流程:
提交者信息只保存在飞书中,不进入 GitHub 或公开页面。
核心改动
.github/workflows/daily-question-sync.yml,接收飞书请求、写入内容并触发网站更新。scripts/sync_daily_question.py,处理日期、内容检查、一天一题、Markdown 格式和安全转义。现有 Hugo 页面、主题、导航和 Pages 工作流保持不变。本次不增加后端、数据库、定时轮询、新页面或第三方运行依赖。
验证结果
Hugo 0.159.0 extended完成整站构建,共生成 439 页。actionlint 1.7.7校验通过。合并后配置
在
Settings -> Actions -> General -> Workflow permissions中确认工作流拥有读写权限。确认
main分支规则允许github-actions[bot]写入每日一问内容。原作者创建只绑定
LeoninCS/GoClub、只有Actions: Read and write权限的细粒度 Token。将飞书 HTTP 自动化地址改为:
https://api.github.com/repos/LeoninCS/GoClub/actions/workflows/daily-question-sync.yml/dispatches将飞书自动化的
Authorization请求头替换为Bearer <新 Token>,请求体继续使用现有配置,ref使用main。通过飞书表单提交一条非敏感内容,确认同步工作流、机器人提交、Pages 发布和页面更新均成功。
可以继续使用现有飞书表格。推荐将原作者加入多维表格并授予自动化管理权限,由原作者亲自填写 Token;也可以通过安全渠道传递 Token 后由表格维护者替换。Token 不应出现在 Issue、PR、微信群或 GitHub 文件中。
无需创建新的 GitHub Actions 应用,无需把该 Token 保存到仓库 Secrets,也无需重新配置现有 GitHub Pages。