DEV Community

Jean-Francis Bastien
Jean-Francis Bastien

Posted on

Checkout only certain files

My Workflow

Bhacaz/checkout-files is useful to only pull specific files from a repository instead of the hold project with the well known actions/checkout. Some project can be very heavy to pull when what you need it’s just 2 or 3 files.

It can be useful if you only need package config files like package.json or Gemfile to setup a Github Action environment, since popular action like ruby/setup-ruby look for the .ruby-version to automatically determine which version to setup and the Gemfile.lock to install the right version of bundler. I personally use it along with an other script to run bundle outdated on a Ruby project. For more details have a look on my other post.

Submission Category:

Wacky Wildcards. Because it's a very general action that can be use for multiple case.

Yaml File or Link to Code

GitHub logo Bhacaz / checkout-files

Github Action checkout only certain files

checkout-files

Github Action to checkout only certain files or folders. Useful if only need certain file, like config or assets for your workflow, instead of pulling all the repo.

Inputs

files

A list of files with the path relative to the $GITHUB_WORKSPACE.

- use: Bhacaz/checkout-files
  with:
    files: Gemfile Gemfile.lock .ruby-version config

token

A Github Private Access Token.

- use: Bhacaz/checkout-files
  with:
    token: ${{ secrets.token }}



Additional Resources / Info

You can find an example of usage in this Ruby on Rails project of mine. Bhacaz/democraylist-be.github/workflows/outdated_gems.yml

Latest comments (0)