1

How can I download only a folder or directory and do a compression before from a remote Git repo hosted on GitHub? The problem is the folder has some executables *.exe in it, and I have to zip (protect) it before going through the firewall.

  • There is an API for the entire branch https://docs.github.com/en/rest/repos/contents#download-a-repository-archive-zip but no way to pick only a specific directory, your best bet is another server to zip the files for you. – Martheen Aug 20 '22 at 08:54
  • this is the first question on stackoverflow, and I got a -1 why? – breitsch breitsch Aug 20 '22 at 09:09

1 Answers1

0

You can associate to that repository (assuming you are the owner, if not, fork it) a GitHub Action.

That GitHub Action can do a sparse checkout of just the folder you want.

The same GitHub action workflow script can then compress the folder and upload it as an artifact.

A curl call can then download that zip file.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250