diff --git a/README.md b/README.md index 3d3d9b6..30cb970 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,9 @@ In order for Towtruck to communicate with the GitHub API, it needs several piece - `CLIENT_ID`: A unique alphanumeric ID assigned to the GitHub App. - `CLIENT_SECRET`: A token used to authenticate API requests. These are generated by GitHub in the app settings. - `WEBHOOK_SECRET`: A user-defined secret used to authenticate GitHub to Towtruck for receiving webhooks. This must be exactly the same as it is entered in the app settings on GitHub. + + +### Seedings + +Once all the other setup steps have been completed run `script/seed` or `script/bootstrap --seed` to seed the data. +This will call the Github API which is rate limit so take care not to to run the script too often. diff --git a/package.json b/package.json index b2fc985..e103676 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "test": "node --test", "lint": "eslint .", "lint:fix": "eslint . --fix", - "format": "prettier --write ." + "format": "prettier --write .", + "seed": "node --env-file=.env ./dataScripts/fetchAllRepos.js" }, "author": "dxw", "license": "MIT", diff --git a/script/bootstrap b/script/bootstrap index 59b35ab..c05e1c9 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -17,3 +17,10 @@ nvm install echo "==> Installing node modules..." npm install + +if [ -n "$1" ]; then + echo "==> Seeding data..." + npm run seed +else + echo "==> Skipping seeding data..." +fi diff --git a/script/seed b/script/seed new file mode 100755 index 0000000..75a6ecd --- /dev/null +++ b/script/seed @@ -0,0 +1,10 @@ +#!/bin/bash + +# script/seed: Seeds the necessary data + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Seeding data..." +npm run seed