Skip to content

Instantly share code, notes, and snippets.

@vdavez
Created November 6, 2015 20:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vdavez/79e33b23b48d354130c2 to your computer and use it in GitHub Desktop.
Save vdavez/79e33b23b48d354130c2 to your computer and use it in GitHub Desktop.
Micro-purchase Google Apps Script
function githubPost() {
var ss = SpreadsheetApp.openById(ssID) // replace the ssID with the Spreadsheet ID
var sheet = ss.getSheetByName("Form Responses 1");
var formResponses = FormApp.getActiveForm().getResponses();
var res = formResponses[formResponses.length-1].getItemResponses();
var amt = res[0].getResponse();
var title = "Load Schedule 70 data into CALC. >>> Current bid: " + amt + " <<<"
var payload = {
"title": title
}
var url = "https://api.github.com/repos/18f/calc/issues/255?access_token=" + ACCESS_TOKEN // Add the Github Access Token
var resp = UrlFetchApp.fetch(url, {method: "patch", payload: JSON.stringify(payload)});
var bidItem = FormApp.getActiveForm().getItems()[0].setHelpText("Your bid may not exceed the lowest bid amount. Currently, the >>> lowest bid amount is $" + amt + "<<<.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment