diff --git a/.github/ISSUE_TEMPLATE/add-new-config.yml b/.github/ISSUE_TEMPLATE/add-new-config.yml index 363383fa..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: @@ -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 comma 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/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 117b3a2c..1658bdf2 100644 --- a/.github/actions/convertIssue/parse-issue-body.js +++ b/.github/actions/convertIssue/parse-issue-body.js @@ -145,7 +145,7 @@ function getSurveyInfo(dataObject) { UserProfileSurvey: { formPath: "https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/survey_resources/" + - dataObject.url_abbreviation + + dataObject.url_abbreviation+ "/" + dataObject.custom_dem_survey_path, version: 1, @@ -265,6 +265,9 @@ 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 { @@ -353,7 +356,15 @@ export async function parseIssueBody(githubIssueTemplateFile, body) { } //list of administrator emails - configObject['admin_dashboard'].admin_access = combinedObject.admin_access.split(','); + let email_list = combinedObject.admin_access.split(','); + 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++) { + email_list[i] = email_list[i].trim(); + } + configObject['admin_dashboard'].admin_access = email_list; //TODO: add handling for custom reminder schemes diff --git a/.github/workflows/issue-to-json.yml b/.github/workflows/issue-to-json.yml index d0c737d1..f35855d3 100644 --- a/.github/workflows/issue-to-json.yml +++ b/.github/workflows/issue-to-json.yml @@ -43,11 +43,13 @@ 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 + 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