actions / actions/checkout

Checking out HEADs of submodules

Open
#503 2 comments 0 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

I recently had much trouble using this action as part of an attempt to checkout submoudle HEADS - See here . It would be great if the action were to be able to do it automatically! Anyway, what I tried was:

    - name: Checkout
      uses: actions/checkout@master
      with:
        submodules: true
        fetch-depth: 1
    - name: Update submodules
      if: ${{ github.event_name != 'pull_request'}}
      run: |
        git pull --recurse-submodules --depth 1
        git submodule update --remote --merge

The result was:

Run git pull --recurse-submodules --depth 1
From https://github.com/vvasuki/kAvyam
 * [new branch]      content         -> origin/content
 * [new branch]      gh-pages        -> origin/gh-pages
 * [new branch]      offline_android -> origin/offline_android
 * [new branch]      trigger_branch  -> origin/trigger_branch
Fetching submodule content
Fetching submodule themes/sanskrit-documentation-theme-hugo
Already up to date.
fatal: Needed a single revision
Unable to find current origin/content revision in submodule path 'content'
Error: Process completed with exit code 1.

The following worked:

Disabling submodules initialization in the action as below

    - name: Checkout
      uses: actions/checkout@master
      with:
        submodules: false

Manual updation:

    - name: Update submodules
      if: ${{ github.event_name != 'pull_request'}}
      run: |
        set -o xtrace
        git submodule update --init --recursive
        git submodule update --remote --merge --recursive

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 by reproducing the reported workflow with actions/checkout and the shown git submodule commands, including the failing shallow checkout case. Read the checkout action's submodule initialization path and determine how automatic HEAD checkout should be specified; done means the reported repository can update its submodules without the manual workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, typescript
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.