Skip to content

arnoson/only-branch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Only Branch

Run (npm) scripts only on a certain branch

only-branch main && npm run deploy

Why

For larger projects, something like github actions can be defined to only run on a specific branch (or even tag). For smaller projects (think simple websites), where I usually deploy directly from my computer, I want the same protection against accidentally running npm run stage on the main branch or npm run deploy on the dev branch.

Usage Example

package.json

{
  "scripts": {
    "deploy": "only-branch main && your-deploy-script",
    "stage": "only-branch dev && your-stage-script"
  }
}

About

Run scripts only on a certain branch

Resources

Stars

Watchers

Forks

Packages

No packages published