title: How to clone public submodule in "Github Actions"
body: <p><em>Reason for this Q&amp;A-Style question: It took me a few hours to get this to run because I had some typos and thought the solution is more complicated. If I would have found a tutorial like this on google or Stackoverflow I would have checked for typos.</em></p>
  
  <p><strong>Git Repository Setup:</strong></p>
  
  <ul>
  <li><strong>Private repository <code>A</code></strong> - name: <code>repoA</code></li>
  <li>with <strong>submodule <code>B</code> (public repository)</strong> - name: <code>repoB</code></li>
  </ul>
  
  <p><strong>Goal:</strong></p>
  
  <ul>
  <li>I want to run a <code>gradle build</code> in <code>repository A &gt; Github Actions</code></li>
  </ul>
  
  <p><strong>Github Action Workflow</strong></p>
  
  <pre><code>name: Test
  on:
    push:
      branches:
        - master
  
  jobs:
    build:
      runs-on: ubuntu-latest
  
      steps:
      - uses: actions/checkout@v1
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <ul>
  <li>The <code>actions/checkout@v1</code> step fails to access the submodule</li>
  </ul>
  
  <p><strong>.gitmodules</strong></p>
  
  <pre><code>[submodule "library"]
      path = library
      url = git@github.com:organization/repoB.git
  
  </code></pre>
  
  <p><strong>Github Actions Step <code>Build with Gradle</code> error</strong></p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine the dependencies of task ':repoA:compileReleaseAidl'.
  &gt; Could not resolve all task dependencies for configuration ':repoA:releaseCompileClasspath'.
     &gt; Could not resolve project :repoBSubmodule1.
       Required by:
           project :repoA
  </code></pre>
  
  <p><strong>What I tried:</strong></p>
  
  <hr>
  
  <ol>
  <li>Add <code>with: submodules: true</code> to <code>actions/checkout@v1</code></li>
  </ol>
  
  <pre><code>    - uses: actions/checkout@v1
        with: 
          submodules: true
  </code></pre>
  
  <p><strong>Github Actions Step <code>Run actions/checkout@v1</code> error</strong></p>
  
  <pre><code>(...)
  git submodule sync
  git -c http.https://github.com.extraheader="AUTHORIZATION: basic ***" submodule update --init --force
  Submodule 'repoB' (git@github.com:organization/repoB.git) registered for path 'repoB'
  Cloning into '/home/runner/work/repoA/repoA/repoB'...
  Host key verification failed.
  ##[error]fatal: Could not read from remote repository.
  </code></pre>
  
  <hr>
  
  <ol start="2">
  <li>Use 3rd party Github Actions like <code>textbook/git-checkout-submodule-action@2.0.0</code></li>
  </ol>
  
  <p><strong>Run textbook/git-checkout-submodule-action@2.00 error:</strong></p>
  
  <pre><code>fatal: Not a git repository (or any parent up to mount point /github/workspace)
  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  ##[error]Docker run failed with exit code 128
  </code></pre>
  
  <hr>
  
  <ol start="3">
  <li><p>Add a <em>personal access token</em> to the <code>actions/checkout</code></p>
  
  <ul>
  <li>The token was generated from a github user which has access to that repository</li>
  <li>The repoA is owned by an organization</li>
  <li>the token has full <code>repo</code> permissions</li>
  </ul></li>
  </ol>
  
  <pre><code>    - uses: actions/checkout@v1
        with: 
          submodules: true
          token: ${{ secrets.GITHUB_REPO_TOKEN }}
  </code></pre>
  
  <p><strong><em>Run actions/checkout@v1 error:</em></strong></p>
  
  <pre><code>git submodule sync
  git -c http.https://github.com.extraheader="AUTHORIZATION: basic ***" submodule update --init --force
  Submodule 'repoB' (git@github.com:organization/repoB.git) registered for path 'repoB'
  Cloning into '/home/runner/work/repoA/repoA/repoB'...
  Host key verification failed.
  ##[error]fatal: Could not read from remote repository.
  </code></pre>
  
  <p>I.e. with the that token which has access to both, repoA and repoB I was not even able to checkout the parent repoA.</p>