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

效果

效果

工具

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

相关推荐
修己xj4 小时前
差生文具多?我给自己改造了一款AI周计划工具
github
库拉大叔4 小时前
GPT-Image-2 文生图:背景虚化怎么描述?
gpt
bkl_92137 小时前
GPT-Image-2 文生图:前景与背景怎么区分?
人工智能·gpt
阿里嘎多学长7 小时前
2026-07-07 GitHub 热点项目精选
开发语言·程序员·github·代码托管
bkl_92139 小时前
GPT-Image-2 文生图:如何稳定生成完整的人物全身照?
后端·gpt·restful
GoGeekBaird10 小时前
我最近在写 BeeWeave,想把 Agent 用过的上下文留住
后端·github·ai编程
DogDaoDao11 小时前
LLM:用一条命令统一所有大语言模型的 CLI 工具
人工智能·语言模型·自然语言处理·llm·github
lpfasd12311 小时前
2026年第27周科技社区趋势周报
github
阿彬学java11 小时前
Mac 本地项目推送至 GitHub 完整指南
github
dong_junshuai13 小时前
每天一个开源项目#26 Caveman:8.2万星的 AI 口语压缩技能,输出减 75%
github