website icon indicating copy to clipboard operation
website copied to clipboard

Edits to `create-new-issue.js`

Open t-will-gillis opened this issue 1 year ago • 2 comments

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

In create-new-issue.js:

  • [ ] 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 avatar Feb 29 '24 05:02 t-will-gillis

@t-will-gillis are you still working on this draft? If you are please assign this to yourself

ExperimentsInHonesty avatar Mar 04 '24 07:03 ExperimentsInHonesty

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 :)

github-actions[bot] avatar Mar 04 '24 22:03 github-actions[bot]

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 :)

github-actions[bot] avatar Mar 15 '24 15:03 github-actions[bot]

i. Availability: F, M, T 2-6pm ii. ETA: EOD Monday March 18

marioantonini avatar Mar 15 '24 15:03 marioantonini

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 avatar Mar 15 '24 18:03 t-will-gillis

@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'?

marioantonini avatar Mar 15 '24 22:03 marioantonini

Hey @marioantonini good catch with the 'artifactContent', thanks! Regarding 'var fs' versus 'const fs': you're right, it should be 'const', thank you again.

t-will-gillis avatar Mar 15 '24 23:03 t-will-gillis