website
website copied to clipboard
Edits to `create-new-issue.js`
Overview
As part of refactoring, the inactive member data generated during contributors-data.js will be saved as a temporary file rather than an artifact because this makes it easier to import the previous month's data into the workflow. Thus we need to change the artifact download into a readFileSync() of the temp file, along with other minor edits. Note: this issue does not require testing of the GHA- final testing will be included with #6193.
Action Items
- [ ] Line 2, insert the line
var fs = require('fs'); - [ ] Replace:
let inactiveLists = JSON.parse(artifactContent);
with:
const filepath = 'github-actions/utils/_data/inactive-members.json';
const rawData = fs.readFileSync(filepath, 'utf8');
let inactiveLists = JSON.parse(rawData);
- [ ] Before
const issue = await createIssue()..., add:
const inactiveWithOpen = parseInactiveOpen(inactiveLists['cannotRemoveYet']);
- [ ] The following code is mostly unreferenced and extraneous, therefore replace:
const issueId = issue.id;
const issueNumber = issue.number;
// Get project id, in order to get the column id of `New Issue Approval` in `Project Board`
const projectId = await getProjectId(owner, repo);
// Get column id, in order to create a project card in `Project Board` and place in `New Issue Approval`
const columnId = await getColumnId(projectId);
// Create the project card, which links to the issue created in createIssue() above
await createProjectCard(issueId, columnId);
with:
const issueNumber = issue.number;
- [ ] Replace:
const commentBody = `**Review Inactive Team Members:** #` + issueNumber;
with:
const commentBody = `**Review Inactive Team Members:** #` + issueNumber + inactiveWithOpen;
- [ ] Add a semicolon to the end of the line at
let thisIssueNumber = ... - [ ] Before
module.exports = main;insert:
const parseInactiveOpen = (inactiveOpens) => {
if(Object.keys(inactiveOpens).length === 0){
return '';
} else {
let inactiveOpen = '\r\n\nInactive members with open issues:\r\n';
for(const [key, value] of Object.entries(inactiveOpens)){
inactiveOpen += ' - ' + key + ': # ' + value + '\r\n';
}
return inactiveOpen;
}
};
Resources/Instructions
- This issue is a dependent for #6193
@t-will-gillis are you still working on this draft? If you are please assign this to yourself
Hi @t-will-gillis, thank you for taking up this issue! Hfla appreciates you :)
Do let fellow developers know about your:- i. Availability: (When are you available to work on the issue/answer questions other programmers might have about your issue?) ii. ETA: (When do you expect this issue to be completed?)
You're awesome!
P.S. - You may not take up another issue until this issue gets merged (or closed). Thanks again :)
Hi @marioantonini, thank you for taking up this issue! Hfla appreciates you :)
Do let fellow developers know about your:- i. Availability: (When are you available to work on the issue/answer questions other programmers might have about your issue?) ii. ETA: (When do you expect this issue to be completed?)
You're awesome!
P.S. - You may not take up another issue until this issue gets merged (or closed). Thanks again :)
i. Availability: F, M, T 2-6pm ii. ETA: EOD Monday March 18
Hey @marioantonini FYI I added one item to the Action Items list (it is the last item about removing the three functions getProjectId(), getColumnId(), and createProjectCard()).
@t-will-gillis main's last argument 'artifactContent' is not used, so removing it. Is there a reason to using var instead of const for loading 'fs'?
Hey @marioantonini good catch with the 'artifactContent', thanks! Regarding 'var fs' versus 'const fs': you're right, it should be 'const', thank you again.