gpt4 book ai didi

c# - 将 nuget 包发布到 GitHub 包时禁止 GITHUB_TOKEN 403

转载 作者:行者123 更新时间:2023-12-03 07:58:41 28 4
gpt4 key购买 nike

我按照这些资源设置了 GitHub Actions 工作流程来构建、测试 dotnet 库并将其发布到 GitHub 包:

这些文章确实很有帮助,但是我遇到了一个他们都没有讨论过的问题:

Pushing MagicLibrary.0.1.3.nupkg to 'https://nuget.pkg.github.com/vivere-dally'...PUT https://nuget.pkg.github.com/vivere-dally/warn : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.Forbidden https://nuget.pkg.github.com/vivere-dally/ 218mserror: Response status code does not indicate success: 403 (Forbidden).

这是我的工作流程文件:

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main

- name: Set VERSION env var from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV


- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Restore dependencies
run: dotnet restore
working-directory: ./MagicLibrary

- name: Build
run: dotnet build --configuration Release /p:Version=${VERSION} --no-restore
working-directory: ./MagicLibrary

- name: Test
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build --verbosity normal
working-directory: ./MagicLibrary

- name: Pack
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
working-directory: ./MagicLibrary

- name: Push
run: dotnet nuget push MagicLibrary.${VERSION}.nupkg --source "https://nuget.pkg.github.com/vivere-dally/index.json" --api-key ${{ secrets.GITHUB_TOKEN }}
working-directory: ./MagicLibrary

为什么GITHUB_TOKEN没有所需的权限?

最佳答案

关于c# - 将 nuget 包发布到 GitHub 包时禁止 GITHUB_TOKEN 403,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75111376/

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