从同一组织的私有仓库安装私有仓库

Install private repository from a private repository of the same organization

我在同一个组织中有两个私有存储库,比如存储库 A 和 B,它们都是 python 包。我有一个“GitHub Actions workflow”来测试每个 PR 的存储库 B。但是,存储库 B 依赖于存储库 A,因此我需要安装它。
我尝试关注 this GitHub document,但是,它明确指出

GITHUB_TOKEN cannot install packages from any private repository besides the repository where the action runs.

我该如何实施这个安装?

这只是意味着,您不能使用预定义的 GITHUB_TOKEN。创建具有 read:packages 范围的个人访问令牌 (PAT),并将其作为秘密添加到您的存储库。

If you need a token that requires permissions that aren't available in the GITHUB_TOKEN, you can create a personal access token and set it as a secret in your repository:

  1. Use or create a token with the appropriate permissions for that repository. For more information, see "Creating a personal access token".
  2. Add the token as a secret in your workflow's repository, and refer to it using the ${{ secrets.SECRET_NAME }} syntax. For more information, see "Creating and using encrypted secrets".

来源:https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token