Skip to content

Commit

Permalink
Google Apps Script: Migrate Wins Data - Stop generation of AF file (#…
Browse files Browse the repository at this point in the history
…7615)

* remove wins-data AF

* CodeQL fixes

* revise w/o prettier

* recreate w/o prettier

* fix line 275 with semicolon
  • Loading branch information
dcotelessa authored Oct 30, 2024
1 parent d6e4fd7 commit 14c7227
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 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 Expand Up @@ -297,7 +272,7 @@ function compareResponsesAndReview() {
}

if (responseValue !== reviewValues[j]) {
console.log("Mismatch found!\nResponse value: " + responseValue + "\nReview value: " + reviewValues[j])
console.log("Mismatch found!\nResponse value: " + responseValue + "\nReview value: " + reviewValues[j]);
unamatched++;
} else {
matched++;
Expand Down

0 comments on commit 14c7227

Please sign in to comment.