gpt4 book ai didi

github-actions - GitHub Actions 可以从私有(private)仓库创建到公共(public)仓库的发布吗?

转载 作者:行者123 更新时间:2023-12-05 06:09:02 26 4
gpt4 key购买 nike

我想创建一个包含供用户下载的 Assets 的版本。由于它是一个私有(private)仓库,我想在一个单独的公共(public)仓库中创建发布。这在 GitHub Actions 中可行吗?

create-release中有ownerrepo参数操作,但在将它们设置为不同的 repo 后我不断收到错误消息:

   - name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }} # A personal access token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
owner: foo
repo: another_public_repo

Error: Validation Failed:{"resource":"Release","code":"custom","field":"tag_name","message":"tag_nameis not a valid tag"},{"resource":"Release","code":"custom","message":"Published releasesmust have a valid tag"},{"resource":"Release","code":"invalid","field":"target_commitish"}

最佳答案

您要么必须在 tag_name 中指定一个现有标签。在您的情况下,这意味着在创建发布之前在公共(public)存储库中创建标签。或者您可以在 commitish 中指定分支或提交 SHA,如果 tag_name 中指定的标记不存在,则使用它。

  - name: Checkout public repository
uses: actions/checkout@v2
with:
repository: foo/another_public_repo
path: another_public_repo
- name: Get tag name from ref
shell: bash
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
id: get_tag
- name: Create tag in public repository
run: |
cd ${{github.workspace}}/another_public_repo
git tag ${{ steps.get_tag.outputs.tag }}
git push --tags --porcelain
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }} # A personal access token
with:
tag_name: ${{ steps.get_tag.outputs.tag }}
release_name: Release ${{ steps.get_tag.outputs.tag }}
draft: false
prerelease: false
owner: foo
repo: another_public_repo

关于github-actions - GitHub Actions 可以从私有(private)仓库创建到公共(public)仓库的发布吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64958538/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com