datalad-clone-action/README.md
Michael Hanke eee0779214
All checks were successful
Exercise test cases / clone-custom-ref (push) Successful in 38s
Exercise test cases / clone-custom-path (push) Successful in 41s
Exercise test cases / clone-origin-repo (push) Successful in 51s
Exercise test cases / clone-recursive (push) Successful in 52s
Exercise test cases / clone-recursive-limited (push) Successful in 52s
Exercise test cases / clone-recursive-no-data (push) Successful in 32s
Exercise test cases / clone-get-deep-content (push) Successful in 33s
Add more usage examples
2024-08-30 12:50:02 +02:00

3.1 KiB

Action to obtain DataLad datasets (git-annex repos) and their annexed content

This action can be considered as an alternative to the standard checkout action when the to-be-checked-out repository is a DataLad dataset with (some) files managed by git-annex.

Without an action like this, obtaining the content of such files requires git-annex to be installed. This is either needs to happen at runtime into a generic environment (causing longer action run times and more traffic), or a specialized environment has to be provided (more maintain once from having environments with and without git-annex).

With this action, the DataLad/git-annex dependency for retrieving a dataset and its file content is encapsulated in a single reusable action.

Usage

For a complete list of parameters, see action.yml in the root of the source repository. Here are a few usage example

Checkout the repository a workflow is running from

This will also download annexed file content for all files in the repository.

...
jobs:
  myjob:
    runs-on: debian-latest

    steps:
      - name: Checkout
        uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1

Obtain some file content and also submodules recursively

The get_content parameter takes paths and globs. Recursive operation can also be restricted to a certain maximum number of level, for example recursive: 2.

    steps:
      - name: Checkout
        uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
        with:
          recursive: true
          get_content: themes content

Obtain a dataset from a different site, and place it at a custom location

This can be helpful when one or more additional dataset are requires for a workflow.

    steps:
      - id: checkout
        uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
        with:
          server_url: https://example.com
          repository: owner/mydataset
          path: clone-of-mydataset
      - run: echo "The dataset is at ${{ steps.checkout.outputs.path }}"

Obtain a specific variant of a file, identified by the root dataset version

In this case, the root dataset is used as a versioned file catalog. From the root dataset the respective version(s) of submodules(s) is/are determined, and the corresponding version of a file in there is obtained.

    steps:
      - id: checkout
        uses: https://hub.datalad.org/forgejo/datalad-clone-action@v1
        with:
          repository: test-resources/datalad-dataset-w-subdataset
          ref: f72dacadd8345ccded6a92a216882bfa2c584c67
          get_content: subdir/subds/annexed_file1.txt

Limitations

At the moment, this implementation is nowhere near the feature set of the checkout action. For example, There is no support for

  • git-annex file retrieval from private repositories
  • SSH-based authentication

See the issue tracker for more information.