V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
zxCoder
V2EX  ›  问与答

gitlab/github 的 CI/CD 这个功能可以保存文件到 git 仓库吗,比如上传 markdown 文件,自动执行程序解析成 html 文件,然后还是保存在这个仓库里

  •  
  •   zxCoder · 2022-03-09 17:33:28 +08:00 · 1010 次点击
    这是一个创建于 789 天前的主题,其中的信息可能已经有所发展或是发生改变。
    5 条回复    2022-03-09 19:55:34 +08:00
    learningman
        1
    learningman  
       2022-03-09 17:45:34 +08:00 via Android   ❤️ 1
    可以,github actions
    Rwing
        2
    Rwing  
       2022-03-09 18:01:15 +08:00   ❤️ 1
    0o0O0o0O0o
        3
    0o0O0o0O0o  
       2022-03-09 18:06:58 +08:00   ❤️ 1
    git config user.name github-actions[bot]
    git config user.email 41898282+github-actions[bot]@users.noreply.github.com

    然后 push 就行

    或者用 github api ,repos.createOrUpdateFileContents ,本仓库不需要申请 PAT ,会自动分配一个 github.token
    swulling
        4
    swulling  
       2022-03-09 18:18:51 +08:00   ❤️ 1
    会,但是别放到同一个分支下,那就成死循环了。

    一般是 main 分支放 markdown ,然后 action 发布到 gh-pages 分支。
    shadows
        5
    shadows  
       2022-03-09 19:55:34 +08:00
    @swulling 用 workflow 自动生成的 GITHUB_TOKEN 不会死循环:

    https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow

    When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs. For example, if a workflow run pushes code using the repository's GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3255 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 12:11 · PVG 20:11 · LAX 05:11 · JFK 08:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.