【问题标题】:Publish in a repo to a specific branch with GitHub Api使用 GitHub Api 在 repo 中发布到特定分支
【发布时间】:2020-01-08 14:49:45
【问题描述】:

我正在创建一个 iOS 工作流来在我的存储库上发布注释,它是 working quite well,但现在我想在一个分支上做它以继续测试。

我正在导出注释文本并传递下一个 url:

https://api.github.com/repos/ramiro-ruiz/ramiroruiz.com/contents/content/notes/slug.md

发送授权令牌和简单的提交消息。

所有这一切都已完成 on master 并将其发送到我尝试通过在 url 末尾添加 ?ref=my-branch (https://api.github.com/repos/ramiro-ruiz/ramiroruiz.com/contents/content/notes/slug.md?ref=my-branch) 的分支,但由于它不断发布到 master ,因此无法正常工作。

有人知道我做错了什么吗?

【问题讨论】:

    标签: github github-api


    【解决方案1】:

    create or update content API 确实包含 branch 参数,而不是 ref 一个。

    PUT /repos/:owner/:repo/contents/:path
    

    branch:分支名称。 Default:仓库的默认分支(通常是master

    【讨论】:

    • 我在想分支应该在 url 中,这很好用。谢谢!
    猜你喜欢
    • 2021-12-29
    • 2020-10-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-15
    • 2017-07-17
    • 2019-10-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多