zxCoder
V2EX  ›  问与答

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

  •  
  •   zxCoder · Mar 9, 2022 · 1728 views
    This topic created in 1717 days ago, the information mentioned may be changed or developed.
    5 replies  •  2022-03-09 19:55:34 +08:00
    learningman
    learningman
    Mar 9, 2022 via Android❤️1
    1
    可以,github actions
    Rwing
    Rwing
    Mar 9, 2022❤️1
    2
    0o0O0o0O0o
    0o0O0o0O0o
    Mar 9, 2022❤️1
    3
    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
    swulling
    Mar 9, 2022❤️1
    4
    会,但是别放到同一个分支下,那就成死循环了。

    一般是 main 分支放 markdown ,然后 action 发布到 gh-pages 分支。
    shadows
    shadows
    Mar 9, 2022
    5
    @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.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1844 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 04:39 · PVG 12:39 · LAX 20:39 · JFK 23:39
    ♥ Do have faith in what you're doing.