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

效果

效果

工具

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

相关推荐
HelloGitHub1 小时前
开源新旗舰 GLM-4.5:不想刷榜,只想干活儿
人工智能·开源·github
陈敬雷-充电了么-CEO兼CTO1 小时前
字节跳动开源Coze,开启AI Agent开发新时代?
人工智能·gpt·chatgpt·开源·大模型·agi·coze
强德亨上校1 小时前
2025年7月21–28日AI开发周报:新模型、新战略与开源亮点
人工智能·科技·gpt·chatgpt·开源·aigc
努力的小T2 小时前
MBR和GPT分区的区别
linux·运维·服务器·gpt·云计算
星际码仔2 小时前
Zread 和 DeepWiki 怎么选?一张图全搞懂
github·chatglm (智谱)
DogDaoDao2 小时前
GitHub开源项目Zerox:AI驱动的OCR革命
人工智能·深度学习·开源·github·ocr·图像识别·zerox
Albert_Lsk3 小时前
【2025/07/28】GitHub 今日热门项目
人工智能·开源·github·开源协议
C++ 老炮儿的技术栈15 小时前
在 Scintilla 中为 Squirrel 语言设置语法解析器的方法
linux·运维·c++·git·ubuntu·github·visual studio
油泼辣子多加15 小时前
2025年07月25日Github流行趋势
github
OpenTiny社区16 小时前
把 SearchBox 塞进项目,搜索转化率怒涨 400%?
前端·vue.js·github