Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Apps Script: Migrate Wins Data - Stop generation of AF file #7615

Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions google-apps-scripts/wins-form-responses/Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,32 +95,7 @@ function main() {
return JSON.stringify(arr1) === JSON.stringify(arr2);
}

/*
** This section deals with the array of data for wins-data.json
** Eventually, lines 91-107 below should be deleted (EXCLUDING createPrResponse) when the team fully migrates from using wins-data.json to _wins-data.json
** The payload is formatted and prepared for an API request to GitHub
*/

// Create an array of data for wins-data.json
const cleanedAndFormattedArrayData = JSON.stringify(filteredRows);
// const encodedArrayData = Utilities.base64Encode(`${cleanedAndFormattedArrayData}`);
const encodedArrayData = Utilities.base64Encode(cleanedAndFormattedArrayData, Utilities.Charset.UTF_8);

// Retrieves latest sha of the wins data file
const arrayFile = "wins-data.json"
const [arrayDataSha, arrayDataContent] = ghrequests.getWins(arrayFile);
if (arrayDataSha === false) {
console.log('Ending script...')
return 1;
}

const writeResponse2 = ghrequests.updateWinsFile(arrayFile, encodedArrayData, arrayDataSha);
if (writeResponse2 === false) {
console.log('Ending script...')
return 1;
}

const createPrResponse = ghrequests.createPR();
ghrequests.createPR();
}

/************************************************** TRIGGER("On Form Submit") 2 SECTION ********************************************************************/
Expand Down Expand Up @@ -267,7 +242,7 @@ function compareResponsesAndReview() {

//Gets the values
for(let i = 0; i <= 10; i++){
values = reviewInfoSplit[i].split(" : ");
const values = reviewInfoSplit[i].split(" : ");
let value = values[1];
if (value !== undefined) {
value = value.trim();
Expand Down