actions / actions/checkout

Not able to checkout remote repo using secrets.GITHUB_TOKEN

Open
#799 13 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
8.9k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

Not able to check out another private repo using secrets.GITHUB_TOKEN. Below the scenario, check out 1, and 2 works. 3 fails. Is there a limitation for secrets.GITHUB_TOKEN on remote repos?

repo-1 from for which GitHub action is running and repo-2 that it's trying to checkout is in the same org

jobs:  
  test:
      name: test
      runs-on: self-hosted
      container: node:14-bullseye
      steps:
      - name: Checkout 1
        uses: actions/checkout@v3
        with:
          fetch-depth: 0      
          
      - name: Checkout 2
        uses: actions/checkout@v3
        with:   
            token: ${{ secrets.MY_PAT }}  
            repository: repo-2
            ref: 'main'     
            path: 'path-1'    
            
      - name: Checkout 3
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }} 
          repository: repo-2
          ref: "master"
          path: "path-2"

Error:
Fetching the repository
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/master*:refs/remotes/origin/master* +refs/tags/master*:refs/tags/master*
remote: Repository not found.
Error: fatal: repository 'https://github.com/xxxxxx/' not found
The process '/usr/bin/git' failed with exit code 128
Waiting 11 seconds before trying again

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the actions/checkout@v3 inputs in the three workflow steps, especially token, repository, ref, and path, and compare the successful PAT checkout with the failing GITHUB_TOKEN checkout. Reproduce the workflow and inspect the reported git fetch error; done means the token limitation or required configuration is confirmed and clearly documented or addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.