unity-builder
unity-builder copied to clipboard
Cannot fetch private GithHub packages with git private token
The build process cannot resolve package dependencies because it cannot fetch private git packages. I could not find any documentation on gitPrivateToken so I tried piecing it together from the issue #161 and the PR #287.
I did the following steps:
- Create a dedicated GitHub user
- Generate a personal access token for the user
- Add the token as a secret to the main repository
- Add the gitPrivateToken to the main.yml
This is my main.yml:
name: Actions 😎
on: [pull_request, workflow_dispatch]
jobs:
build:
name: Build my project ✨
runs-on: windows-2019
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: true
#- uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# Cache
- uses: actions/cache@v2
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
# Test
#- name: Run tests
# uses: game-ci/unity-test-runner@v2
# env:
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
# with:
# githubToken: ${{ secrets.GITHUB_TOKEN }}
# Upload Tests
#- name: Upload test results
# uses: actions/upload-artifact@v2
# if: always()
# with:
# name: Test results
# path: artifacts
# Build
- name: Build project
uses: game-ci/unity-builder@v2
env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: StandaloneWindows64
#sshAgent: ${{ env.SSH_AUTH_SOCK }}
buildMethod: Smartcave.BuildManager.Build
customParameters: -buildConfig Default -username='${{ secrets.USERNAME }}' -password='${{ secrets.PASSWORD }}'
gitPrivateToken: ${{ secrets.PRIVATE_TOKEN }}
# Output
- uses: actions/upload-artifact@v2
with:
name: Build
path: build
And this is the error:
An error occurred while resolving packages:
Project has invalid dependencies:
solutions.smartcave.common: Error when executing git command. fatal: Cannot prompt because terminal prompts have been disabled.
fatal: could not read Username for 'https://github.com/': terminal prompts disabled
You may need to set up a Git credentials helper
to access a private repository.
solutions.smartcave.creatortools: Error when executing git command. fatal: Cannot prompt because terminal prompts have been disabled.
fatal: could not read Username for 'https://github.com/': terminal prompts disabled
You may need to set up a Git credentials helper
to access a private repository.
I tried cloning the package repos using the private tokens via git bash which works. So I guess the build process is not properly using the private token for some reason.
I would appreciate any help with the issue as I am running out of ideas 🤷
The problem seems to be that the "gitPrivateToken" feature has only been added for linux. I will try to get my pipeline running on linux for now and see if I can port it to windows if I get to it. I can confirm that building with private packages works on linux.