麦当劳自动领券
使用GitHub Actions每日自动通过麦当劳MCP领取优惠券,并将结果记录在Issues中。
使用方法
1. 获取MCP Token
登录麦当劳MCP平台,获取MCP Token
2. 设置环境变量
点击页面右上角的 "Fork" 按钮将此仓库fork到你的GitHub账户,然后在你的fork仓库中作如下设置:
- 进入仓库的
Settings页面 - 选择
Secrets and variables>Actions - 点击
New repository secret - 添加以下Secret:
- Name: MCD_MCP_TOKEN - Secret: 你的MCP Token
3. 配置GitHub Actions权限
为了使工作流能够创建和管理Issues,需要配置适当的权限:
- 进入仓库的
Settings页面 - 选择
Actions>General - 向下滚动到
Workflow permissions部分 - 选择 Read and write permissions
- 勾选 Allow GitHub Actions to create and approve pull requests
- 点击 Save 保存设置
4. 启用GitHub Actions
- 进入仓库的
Actions页面 - 点击 "I understand my workflows, go ahead and enable them"
5. 手动测试(可选)
你可以手动触发工作流来测试设置:
- 进入
Actions页面 - 选择 "自动领取优惠券" 工作流
- 点击 "Run workflow"
工作流说明
执行时间
- 每日北京时间上午9:00 (UTC 1:00) 自动执行
- 支持手动触发执行
执行流程
- 检出代码并设置Python环境
- 安装依赖包
- 运行优惠券领取脚本
- 解析执行结果
- 创建GitHub Issue记录结果
本地开发
环境要求
- Python 3.8+
- requests库
安装依赖
pip install -r requirements.txt本地运行
设置环境变量并运行脚本:
# Windows
set MCD_MCP_TOKEN=your_token_here
python auto_bind_coupons.py
# Linux/Mac
export MCD_MCP_TOKEN=your_token_here
python auto_bind_coupons.py故障排除
常见问题
- Token未设置
- 确保在GitHub Secrets中正确设置了 MCD_MCP_TOKEN
- 网络连接问题
- 检查API服务是否可用 - 查看GitHub Actions日志中的详细错误信息
- 权限问题
- 确保仓库启用了Actions功能 - 检查Token是否有足够的权限 - Issue创建失败: 如果看到 "Resource not accessible by integration" 错误: - 检查仓库的 Workflow permissions 设置是否为 Read and write permissions - 确认工作流文件中包含以下权限配置:
permissions:
contents: read
issues: write许可证
本项目采用MIT许可证。
