Skip to content

Commit

Permalink
Merge pull request #58 from Abby-Wheelis/config-gen-issues
Browse files Browse the repository at this point in the history
Updates to Config Generation
  • Loading branch information
shankari authored Feb 2, 2024
2 parents 724c285 + 4b06d9c commit 0007204
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/add-new-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/actions/convertIssue/issue-to-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
15 changes: 13 additions & 2 deletions .github/actions/convertIssue/parse-issue-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/issue-to-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0007204

Please sign in to comment.