Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot fetch private GithHub packages with git private token #428

Closed
Peaj opened this issue Aug 26, 2022 · 1 comment · Fixed by #529
Closed

Cannot fetch private GithHub packages with git private token #428

Peaj opened this issue Aug 26, 2022 · 1 comment · Fixed by #529
Labels
bug Something isn't working git private repo

Comments

@Peaj
Copy link

Peaj commented Aug 26, 2022

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/ssh-agent@v0.5.2
      #  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 🤷

@davidmfinol davidmfinol added the bug Something isn't working label Aug 26, 2022
@Peaj
Copy link
Author

Peaj commented Sep 9, 2022

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.

AndrewKahr added a commit to AndrewKahr/unity-builder that referenced this issue Mar 5, 2023
AndrewKahr added a commit to AndrewKahr/unity-builder that referenced this issue Mar 5, 2023
@AndrewKahr AndrewKahr mentioned this issue Mar 28, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working git private repo
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants