Skip to content

Instantly share code, notes, and snippets.

@jmolivas
Last active February 6, 2021 16:21
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jmolivas/bab53777bee19caebb5ca31d1f8b6e11 to your computer and use it in GitHub Desktop.
Save jmolivas/bab53777bee19caebb5ca31d1f8b6e11 to your computer and use it in GitHub Desktop.
Trigger Netlify build from a Google Spreadsheet
# From your Google Spreadsheet, select the menu item Tools > Script editor.
# Copy and paste this code.
# Replace uuid with the build_hooks uuid from your Netlify project.
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Scripts')
.addItem('Build', 'build')
.addToUi();
}
function build() {
UrlFetchApp.fetch('https://api.netlify.com/build_hooks/uuid', {
'method': 'post',
})
}
@vermario
Copy link

vermario commented Apr 3, 2019

I made it work for circleci as well:

function onOpen() {
  SpreadsheetApp.getUi()
      .createMenu('Scripts')
      .addItem('Build', 'build')
      .addToUi();
}
function build() {
  UrlFetchApp.fetch('https://circleci.com/api/v1.1/project/__YOUR_PROVIDER/_YOURORGANIZATION/_YOUR_REPO/build?circle-token=_YOUR_PERSONAL_API_TOKEN', {
    'method': 'post',
    'contentType': 'application/json',
    'body' : {"branch":"_YOURBRANCHNAME"}
  })
}

@jmolivas
Copy link
Author

jmolivas commented Apr 3, 2019

@vermario that is really nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment