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

Is it possible to checkout to enterprise github repo from non enterprise public repo in github actions? #563

Open
LakshmiRavali opened this issue Aug 6, 2021 · 3 comments

Comments

@LakshmiRavali
Copy link

I want to checkout to enterprise github repo from non-enterprise public repo. These are my actions:

jobs:
  checkout:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x]
    steps:
    - name: Checkout private tools
      uses: actions/checkout@v2
      with:
        repository: enterprise/repo
        token: ${{ secrets.ENTERPRISE_TOKEN }} 
        path: main

but as I saw it will clone https://github.com/enterprise/repo, but my enterprise account is on a different domain. Is it possible to checkout to the enterprise account?

@LakshmiRavali
Copy link
Author

When I am checking the code, there is a environment variable for server url. I am trying to set it like this:

jobs:
  checkout:
    runs-on: ubuntu-latest
    env:
        GITHUB_SERVER_URL: {{ENTERPRISE_URL}}
        GITHUB_API_URL: {{ENTERPRISE_URL}}
    strategy:
      matrix:
        node-version: [10.x]
    steps:
    - name: Checkout private tools
      uses: actions/checkout@v2
      with:
        repository: enterprise/repo
        token: ${{ secrets.ENTERPRISE_TOKEN }} 
        path: main

but still, I am getting the error

Retrieving the default branch name
  Error: Bad credentials

Can anyone let me know how to use the environment variable to set the server URL?

@mike7ang1rdz
Copy link

could you solve it?, i have the same issue

@lancetarn
Copy link

I would like to do this as well. It seems impossible with this action. Overriding environment variables namespaced with GITHUB_ is explicitly forbidden as described here

Makes me wonder if things would break if this was turned into an input that the url-helper respected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants