Skip to main content

Example GitHub Action workflow to auto push a specified directory to a different GitHub repo

· One min read

I made an example GitHub Action workflow that will automatically push all files in a specified directory to a different GitHub repo using a GitHub deploy key. By enabling GitHub Pages for the destination repo, you can serve content dynamically generated by a GitHub action workflow/job.

Check it out!

Use cases

  • Publish static (gatsby, jekyll etc.) site to separate GitHub repository
  • Publish build results to a web endpoint
  • Publish istanbul test coverage from unit/integration tests
  • Publish a custom badge like shields.io (e.g a test coverage badge)

Why?

  • Free serving of public websites with git history (public repositories don't cost anything)
  • Don't have to pay for services like codecov.io or coveralls.io
  • Don't bloat your main repo with a long history of ever changing files.
  • Don't risk exposing any personal github token from a github action (a leak which which could give someone access to your whole GitHub account).