Skip to content

Push subdirectories in a monorepo to separate, read-only repositories

License

Notifications You must be signed in to change notification settings

cwonrails/actions-push-subdirectories

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Push Subdirectories

GitHub Action to push subdirectories to separate repositories.

Why?

When building Gatsby Themes with a monorepo it's common to need to be able to develop your corresponding starters in the same repo as well. This allows you to automatically push your starters to their own repo so they can be used with gatsby new.

Usage

name: Publish Starters
on: push
jobs:
  master:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: publish:starters
        uses: johno/actions-push-subdirectories@master
        env:
          API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          args: examples johno

The GITHUB_TOKEN will automatically be defined, the API_TOKEN_GITHUB needs to be set in the Secrets section of your repository options. You can retrieve the API_TOKEN_GITHUB here (set the repo permission).

The action accepts three arguments - the first two are mandatory, the third is optional.

  1. Name of the folder that contains your examples. Even if you only have one example currently it also should be placed inside its own folder (e.g. examples/foo-bar) as the script will read all folders inside the examples.
  2. GitHub username
  3. Repository name of the respective example. By default the name key from the example's package.json is used, e.g. the name of your example is gatsby-starter-foobar, then the script will try to push to github.com/USERNAME/gatsby-starter-foobar.

Custom starter names

You could define the key starter-name in your example's package.json, like:

{
  "starter-name": "gatsby-starter-custom-foobar",
}

Use the action with the third argument now:

args: examples johno starter-name

Related

This code is adapted and modified from Gatsby core.

About

Push subdirectories in a monorepo to separate, read-only repositories

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 67.1%
  • Dockerfile 32.9%