我想创建一个包含供用户下载的 Assets 的版本。由于它是一个私有(private)仓库,我想在一个单独的公共(public)仓库中创建发布。这在 GitHub Actions 中可行吗?
create-release中有owner
和repo
参数操作,但在将它们设置为不同的 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_name is not a valid tag"}, {"resource":"Release","code":"custom","message":"Published releases must 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/