V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
LxnChan
V2EX  ›  GitHub

求助: Github Actions 无法 Push 到仓库

  •  
  •   LxnChan ·
    lxnchan · 2023-03-11 21:35:08 +08:00 · 906 次点击
    这是一个创建于 384 天前的主题,其中的信息可能已经有所发展或是发生改变。

    仓库是私有仓库,创建了个 Github Actions 用于从国外自动 fetch 一些配置文件到仓库内,不过无论如何都没法 Push 上去,提示没有写权限。

    Github Actions YAML:

    - name: Commit & Push changes
      uses: actions-js/[email protected]
      with:
        github_token: ${{ secrets.REPOKEY }}
        message: "update data"
        author_email: 'xxx'
        author_name: 'LxnChan'
    

    REPOKEY在仓库的 Settings 中有正确创建,该 Token 类型为 Classic ,已有的权限有admin:repo_hook, repo, workflow,永不过期。

    报错:

    第 1 条附言  ·  2023-03-11 22:44:44 +08:00

    解决了,在仓库Settings-Actions-General-Workflow permissions,选择Read and write permissions

    不知道为啥还整个这个选项,这不跟Token创建的时候的权限选择冲突了嘛

    4 条回复    2023-03-11 22:45:05 +08:00
    arvin01
        1
    arvin01  
       2023-03-11 22:04:35 +08:00
    `github_token` 这里直接用 `${{ secrets.GITHUB_TOKEN }}` 试试?
    LxnChan
        2
    LxnChan  
    OP
       2023-03-11 22:31:38 +08:00
    @arvin01 创建不了以 GITHUB_开头的 secrets
    Ggmusic
        3
    Ggmusic  
       2023-03-11 22:43:01 +08:00 via iPhone   ❤️ 1
    @LxnChan 不用你建,actions 自动生成,但是需要在 settings - Actions-workflow permissions 里设置下权限,改成 read and write 。
    LxnChan
        4
    LxnChan  
    OP
       2023-03-11 22:45:05 +08:00
    @Ggmusic 才发现🤣
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2796 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:02 · PVG 23:02 · LAX 08:02 · JFK 11:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.