From aa91d07e9e043a1920e466cbae7af6adc3366e7c Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Thu, 25 Jan 2024 11:08:50 -0700 Subject: [PATCH 01/11] pr action commits ALL changes by default on a recent test, all the depedencies got committed, again We ONLY want changes in the config folder, so we must specify the add-paths parameter --- .github/workflows/issue-to-json.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/issue-to-json.yml b/.github/workflows/issue-to-json.yml index d0c737d1..d066976d 100644 --- a/.github/workflows/issue-to-json.yml +++ b/.github/workflows/issue-to-json.yml @@ -43,6 +43,8 @@ jobs: id: cpr uses: peter-evans/create-pull-request@v5 with: + add-paths: | + configs/ commit-message: Create or update a new config file signoff: false branch: new-config From 5f8016558f4d18e578e76a34d9535c4ac586963b Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Thu, 25 Jan 2024 11:09:17 -0700 Subject: [PATCH 02/11] more explanatory names updating naming conditions to prevent duplication and keep track of the issue number --- .github/workflows/issue-to-json.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-to-json.yml b/.github/workflows/issue-to-json.yml index d066976d..f35855d3 100644 --- a/.github/workflows/issue-to-json.yml +++ b/.github/workflows/issue-to-json.yml @@ -47,9 +47,9 @@ jobs: configs/ commit-message: Create or update a new config file signoff: false - branch: new-config + branch: new-config-#${{ env.IssueNumber }} delete-branch: false - title: '[Config] create new file' + title: '[Config #${{ env.IssueNumber }}] create new file' body: | Adding a new config file - Initialized by creating or updating the coressponding issue From a2ef78b9200a93acc4580b44d37bdb9da2e76866 Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Fri, 26 Jan 2024 10:46:56 -0700 Subject: [PATCH 03/11] admin access edits strip off the leading and trailing whitespace so the emails are valid set a failure when the list is too long --- .github/actions/convertIssue/parse-issue-body.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/convertIssue/parse-issue-body.js b/.github/actions/convertIssue/parse-issue-body.js index 117b3a2c..7b663674 100644 --- a/.github/actions/convertIssue/parse-issue-body.js +++ b/.github/actions/convertIssue/parse-issue-body.js @@ -353,7 +353,15 @@ export async function parseIssueBody(githubIssueTemplateFile, body) { } //list of administrator emails - configObject['admin_dashboard'].admin_access = combinedObject.admin_access.split(','); + admin_list = combinedObject.admin_access.split(','); + if (admin_list.length > 4){ + setFailed("sorry, admin access is limited to a maximum of 4 emails, please shorten your list of emails"); + } + // leading/trailing whitespace will lead to errors + for (let i = 0; i < admin_list.length; i++) { + admin_list[i] = admin_list[i].strip(); + } + configObject['admin_dashboard'].admin_access = admin_list; //TODO: add handling for custom reminder schemes From 14ecaea7ce4792ad116fc5e57557b379d5f4d954 Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Fri, 26 Jan 2024 10:55:55 -0700 Subject: [PATCH 04/11] better naming rename to email_list (admin_list was duplicated) and actually instantiate the variable so the process works --- .github/actions/convertIssue/parse-issue-body.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/convertIssue/parse-issue-body.js b/.github/actions/convertIssue/parse-issue-body.js index 7b663674..65a0ac16 100644 --- a/.github/actions/convertIssue/parse-issue-body.js +++ b/.github/actions/convertIssue/parse-issue-body.js @@ -353,15 +353,15 @@ export async function parseIssueBody(githubIssueTemplateFile, body) { } //list of administrator emails - admin_list = combinedObject.admin_access.split(','); - if (admin_list.length > 4){ + let email_list = combinedObject.admin_access.split(','); + if (email_list.length > 4){ setFailed("sorry, admin access is limited to a maximum of 4 emails, please shorten your list of emails"); } // leading/trailing whitespace will lead to errors - for (let i = 0; i < admin_list.length; i++) { - admin_list[i] = admin_list[i].strip(); + for (let i = 0; i < email_list.length; i++) { + email_list[i] = email_list[i].strip(); } - configObject['admin_dashboard'].admin_access = admin_list; + configObject['admin_dashboard'].admin_access = email_list; //TODO: add handling for custom reminder schemes From c3385c1c388e31d1e8129a48267c3c7ec9e11405 Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Fri, 26 Jan 2024 11:14:24 -0700 Subject: [PATCH 05/11] correct syntax mistake --- .github/actions/convertIssue/parse-issue-body.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/convertIssue/parse-issue-body.js b/.github/actions/convertIssue/parse-issue-body.js index 65a0ac16..9859e939 100644 --- a/.github/actions/convertIssue/parse-issue-body.js +++ b/.github/actions/convertIssue/parse-issue-body.js @@ -359,7 +359,7 @@ export async function parseIssueBody(githubIssueTemplateFile, body) { } // leading/trailing whitespace will lead to errors for (let i = 0; i < email_list.length; i++) { - email_list[i] = email_list[i].strip(); + email_list[i] = email_list[i].trim(); } configObject['admin_dashboard'].admin_access = email_list; From 7751fa00f96a6c6a34f3842a80c84915472e9f1d Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Fri, 26 Jan 2024 11:14:39 -0700 Subject: [PATCH 06/11] add limit warning to the form itself --- .github/ISSUE_TEMPLATE/add-new-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/add-new-config.yml b/.github/ISSUE_TEMPLATE/add-new-config.yml index 363383fa..dbdc5684 100644 --- a/.github/ISSUE_TEMPLATE/add-new-config.yml +++ b/.github/ISSUE_TEMPLATE/add-new-config.yml @@ -510,7 +510,7 @@ body: id: admin_access attributes: label: Admin Access Emails - description: Please enter a comman separated list of emails to which we will grant access to the admin dashboard. This will usually be a relatively short list. + description: Please enter a comman separated list of emails to which we will grant access to the admin dashboard. [MAX 4] validations: required: true # - type: dropdown From 319d4d13a7451ca030756c478d348d191c2bdd76 Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Fri, 26 Jan 2024 11:28:47 -0700 Subject: [PATCH 07/11] increase limit to 5 based on review comment - https://github.com/e-mission/nrel-openpath-deploy-configs/pull/49#discussion_r1421777077 --- .github/ISSUE_TEMPLATE/add-new-config.yml | 2 +- .github/actions/convertIssue/parse-issue-body.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/add-new-config.yml b/.github/ISSUE_TEMPLATE/add-new-config.yml index dbdc5684..5c108520 100644 --- a/.github/ISSUE_TEMPLATE/add-new-config.yml +++ b/.github/ISSUE_TEMPLATE/add-new-config.yml @@ -510,7 +510,7 @@ body: id: admin_access attributes: label: Admin Access Emails - description: Please enter a comman separated list of emails to which we will grant access to the admin dashboard. [MAX 4] + description: Please enter a comman separated list of emails to which we will grant access to the admin dashboard. [MAX 5] validations: required: true # - type: dropdown diff --git a/.github/actions/convertIssue/parse-issue-body.js b/.github/actions/convertIssue/parse-issue-body.js index 9859e939..d0147223 100644 --- a/.github/actions/convertIssue/parse-issue-body.js +++ b/.github/actions/convertIssue/parse-issue-body.js @@ -354,8 +354,8 @@ export async function parseIssueBody(githubIssueTemplateFile, body) { //list of administrator emails let email_list = combinedObject.admin_access.split(','); - if (email_list.length > 4){ - setFailed("sorry, admin access is limited to a maximum of 4 emails, please shorten your list of emails"); + if (email_list.length > 5){ + setFailed("sorry, admin access is limited to a maximum of 5 emails, please shorten your list of emails"); } // leading/trailing whitespace will lead to errors for (let i = 0; i < email_list.length; i++) { From 9235d30620f85a019ae510032cc8332687eb3841 Mon Sep 17 00:00:00 2001 From: Abby Wheelis <54848919+Abby-Wheelis@users.noreply.github.com> Date: Thu, 1 Feb 2024 09:24:36 -0700 Subject: [PATCH 08/11] typo comman -> comma --- .github/ISSUE_TEMPLATE/add-new-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/add-new-config.yml b/.github/ISSUE_TEMPLATE/add-new-config.yml index 5c108520..b26e35a5 100644 --- a/.github/ISSUE_TEMPLATE/add-new-config.yml +++ b/.github/ISSUE_TEMPLATE/add-new-config.yml @@ -510,7 +510,7 @@ body: id: admin_access attributes: label: Admin Access Emails - description: Please enter a comman separated list of emails to which we will grant access to the admin dashboard. [MAX 5] + description: Please enter a comma separated list of emails to which we will grant access to the admin dashboard. [MAX 5] validations: required: true # - type: dropdown From 93a9ad931a2f0892b0e64895bdb060ed7425a21a Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Thu, 1 Feb 2024 16:51:41 -0700 Subject: [PATCH 09/11] forcing lower case --- .github/actions/convertIssue/issue-to-json.js | 1 + .github/actions/convertIssue/parse-issue-body.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/convertIssue/issue-to-json.js b/.github/actions/convertIssue/issue-to-json.js index 3c97b7bd..b0d689a5 100644 --- a/.github/actions/convertIssue/issue-to-json.js +++ b/.github/actions/convertIssue/issue-to-json.js @@ -41,6 +41,7 @@ export async function issueToJson() { await mkdir(outputDir, { recursive: true }); let abbrevKey = getInput("hash-property-name"); + abbrevKey = abbrevKey.toLowerCase(); let fileName = getFileName(configData[ abbrevKey ]); await writeFile(path.join(outputDir, fileName), JSON.stringify(configData, null, 2)); } catch (error) { diff --git a/.github/actions/convertIssue/parse-issue-body.js b/.github/actions/convertIssue/parse-issue-body.js index d0147223..63b5b6e4 100644 --- a/.github/actions/convertIssue/parse-issue-body.js +++ b/.github/actions/convertIssue/parse-issue-body.js @@ -141,11 +141,12 @@ function getSurveyInfo(dataObject) { }, }; } else { + let lower_url = dataObject.url_abbreviation.toLowerCase(); surveyInfo.surveys = { UserProfileSurvey: { formPath: "https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/survey_resources/" + - dataObject.url_abbreviation + + lower_url+ "/" + dataObject.custom_dem_survey_path, version: 1, @@ -268,7 +269,7 @@ export async function parseIssueBody(githubIssueTemplateFile, body) { //then compose the config object let configObject = {}; try { - configObject["url_abbreviation"] = combinedObject.url_abbreviation; + configObject["url_abbreviation"] = combinedObject.url_abbreviation.toLowerCase(); configObject["version"] = 1; configObject["ts"] = Date.now(); From ac04a894405cc03c0d6513fcff53af0a90336d59 Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Thu, 1 Feb 2024 17:03:25 -0700 Subject: [PATCH 10/11] only push to lowercase once --- .github/actions/convertIssue/parse-issue-body.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/convertIssue/parse-issue-body.js b/.github/actions/convertIssue/parse-issue-body.js index 63b5b6e4..1658bdf2 100644 --- a/.github/actions/convertIssue/parse-issue-body.js +++ b/.github/actions/convertIssue/parse-issue-body.js @@ -141,12 +141,11 @@ function getSurveyInfo(dataObject) { }, }; } else { - let lower_url = dataObject.url_abbreviation.toLowerCase(); surveyInfo.surveys = { UserProfileSurvey: { formPath: "https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/survey_resources/" + - lower_url+ + dataObject.url_abbreviation+ "/" + dataObject.custom_dem_survey_path, version: 1, @@ -266,10 +265,13 @@ export async function parseIssueBody(githubIssueTemplateFile, body) { let bodyData = parseBodyData(body); let combinedObject = parseCombined(fields, bodyData); + // must be lower case + combinedObject.url_abbreviation = combinedObject.url_abbreviation.toLowerCase(); + //then compose the config object let configObject = {}; try { - configObject["url_abbreviation"] = combinedObject.url_abbreviation.toLowerCase(); + configObject["url_abbreviation"] = combinedObject.url_abbreviation; configObject["version"] = 1; configObject["ts"] = Date.now(); From 4b06d9ce347dea36508424e5486438705a68c317 Mon Sep 17 00:00:00 2001 From: Abby Wheelis Date: Thu, 1 Feb 2024 17:08:14 -0700 Subject: [PATCH 11/11] misleading url instructions --- .github/ISSUE_TEMPLATE/add-new-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/add-new-config.yml b/.github/ISSUE_TEMPLATE/add-new-config.yml index b26e35a5..6494cf6e 100644 --- a/.github/ISSUE_TEMPLATE/add-new-config.yml +++ b/.github/ISSUE_TEMPLATE/add-new-config.yml @@ -322,7 +322,7 @@ body: attributes: label: Custom Labels description: If you chose false above, and want drowdown style labeling, please provide the file name for your custom labels. You will need to submit a PR to add it to our repo - https://github.com/e-mission/nrel-openpath-deploy-configs/tree/main/label_options - placeholder: https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/label_options/example-program-label-options.json + placeholder: example-program-label-options.json - type: markdown attributes: