Skip to content

Not able to checkout remote repo using secrets.GITHUB_TOKEN #799

Open
@shyam-ks

Description

@shyam-ks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions