dify工作流+github actions实现翻译并创建PR

受bookmark-summary启发,制作了一套翻译流程,使用浏览器插件收藏文章后,自动翻译并提交pr到github仓库,流程如下:

流程

浏览器插件Memo

浏览器收藏页面,支持添加标签,可以根据标签执行不同的流程,需要翻译的文章我会在增加一个#translate标签

github actions

github actions会监听到浏览器插件的收藏事件(仓库中markdown文件会新增一行),然后调用dify workflow翻译文章,翻译结果会提交到github仓库

dify workflow

使用jina抓取网页内容,返回markdown格式,在调用gpt翻译

创建pr

使用github actions创建pr

配置:

yaml 复制代码
# 创建pr
- name: pr blog
  uses: peter-evans/create-pull-request@v7
  with:
    path: blog # 需要pr的repo位置
    token: ${{ secrets.GH_TOKEN }} # github accesstoken
    commit-message: 提交翻译到仓库
    committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
    signoff: false
    branch: posts
    delete-branch: true
    title: "提交翻译到仓库"
    body: |
      新增翻译内容
      - Auto-generated by [create-pull-request][1]
      [1]: https://github.com/peter-evans/create-pull-request
    labels: |
      automated pr : translate
    draft: false
注意

在一个github action 任务中checkout出2个仓库时有些需要注意的点,防止踩坑:

  • pr的目标仓库需要先设置允许访问(设置中打开 "Accessible from repositories owned by the user xxx"),否则会报错
yaml 复制代码
- name: Checkout bookmark
  uses: actions/checkout@v4
  with:
    path: bookmark

# 需要再blog repo打开配置 Access-> Accessible from repositories owned by the user 'yiGmMk'
- name: Checkout blog
  uses: actions/checkout@v4
  with:
    token: ${{ secrets.GH_TOKEN }}
    path: blog
    repository: yiGmMk/blog
    ref: master

效果

效果

工具

在这个流程中使用的工具:

相关推荐
Maynor9966 小时前
开源12个电商出图Agent Skills:GPT Image 2.5一键出图
gpt·ai绘画·跨境电商·claude code·agent skills·gpt image
miofly11 小时前
Reflection AI 发布 501B 参数开放权重模型 Beam
开源·github
网络毒刘12 小时前
GPT-6.1 Sol 定位速读:成本效率型编码模型与「何时该换本地 Agent」
人工智能·gpt·openai·agent·cursor
m4Rk_13 小时前
【论文阅读】Agent 记忆机制(91):THEANINE——不删除过时记忆,让 Agent 记住事情是如何变化的
论文阅读·人工智能·学习·开源·github
高频因子挖掘机15 小时前
批量行情返回后,怎样把请求失败的股票单独挑出来?
后端·github·api
XLYcmy15 小时前
PDF 论文处理器 — 优势与功能文档
大数据·python·网络安全·pdf·dify·rag·漏洞检测
Vex2une16 小时前
Windows 磁盘管理发展史:从 FDISK 分区表到存储池与虚拟磁盘
windows·gpt·磁盘管理·mbr·fdisk·动态磁盘·储存池
奥德元16 小时前
XiaoMate功能介绍: 让桌宠帮你分析你的桌面屏幕
github
TunerT_TQ16 小时前
【开源评测】dots:自带浏览器的 Web AI Agent——C++ 级反检测路径的工程取舍与争议
github
Maynor在掘金17 小时前
1.9 万 Star 的 Hypit:让 AI Agent 帮你“一键复刻”爆款视频,保姆级上手教程
vue.js·github