Skip to content

Instantly share code, notes, and snippets.

@richjava
Last active September 27, 2020 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richjava/ea0d447496ae5ec2c5c8319bbed1680c to your computer and use it in GitHub Desktop.
Save richjava/ea0d447496ae5ec2c5c8319bbed1680c to your computer and use it in GitHub Desktop.
Create Netlify site from repo
const netlifySitesUrl = `https://api.netlify.com/api/v1/sites`;
let netlifyRes = await axios.post(
netlifySitesUrl + `?access_token=${netlifyAccessToken}`,
{
repo: {
provider: "github",
id: repoInfo.data.id,
repo: `${repoInfo.data.owner.login}/${repoInfo.data.name}`,
private: false,
branch: "master",
cmd: "npm run build",
dir: "public/",
deploy_key_id: netlifyRes.data.public_key,
env: {
API_ENDPOINT:
"..."
},
},
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment