From 2862887c63d8f0a84a8cba3f8d0c2d4119090707 Mon Sep 17 00:00:00 2001 From: Adele Gauvrit Date: Mon, 14 Aug 2023 11:48:35 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=A8=20Add=20job=20id=20column?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 47c3c42..dc46c06 100644 --- a/index.ts +++ b/index.ts @@ -19,6 +19,7 @@ interface Job { name: string; }; jobs: { + id: number; started_at: string; completed_at: string; name: string; @@ -87,7 +88,7 @@ const getWorkflowsAndStoreThem = async ( await readFile("frontend/src/graphsData/workflows.json", "utf-8") ) as Workflow[]; } catch (e) { - console.log("No previously storred workflows found"); + console.log("No previously stored workflows found"); } const previousWorkflowRunsIds = previousWorkflowRuns.map( @@ -224,7 +225,7 @@ const getJobsFromWorkflows = async ( if (saveCsv === true) { const CSV_HEADER = - "workflow_id, workflow_name, workflow_job_count, name, started_at, completed_at\n"; + "job_id, workflow_id, workflow_name, workflow_job_count, name, started_at, completed_at\n"; const fullContent = jobs.reduce((content, workflowJobs) => { const workflowId = workflowJobs.workflow.id; const workflowName = workflowJobs.workflow.name; From 2ec93bcb18adb9ed4a3d3982d6423f867a092a78 Mon Sep 17 00:00:00 2001 From: Adele Gauvrit Date: Mon, 14 Aug 2023 11:49:20 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=92=85=20Format=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index dc46c06..01c00ad 100644 --- a/index.ts +++ b/index.ts @@ -65,6 +65,20 @@ const MAX_NUMBER_OF_NEW_WORKFLOWS = parseInt( process.env.MAX_NUMBER_OF_NEW_WORKFLOWS ); +const dateFormat = new Intl.DateTimeFormat("en-US", { + year: "numeric", + month: "2-digit", + day: "2-digit", +}); +const timeFormat = new Intl.DateTimeFormat("en-US", { + hour: "2-digit", + minute: "2-digit", + second: "2-digit", +}); +const formatCSVDate = (date: Date): string => { + return `${dateFormat.format(date)} ${timeFormat.format(date)}`; +}; + const getScriptParameters = (): ScriptParameters => { const args = process.argv; const saveCsv = args.findIndex((argument) => argument === "--save-csv") >= 0; @@ -131,7 +145,9 @@ const getWorkflowsAndStoreThem = async ( if (saveCSV) { const CSV_HEADER = "id, jobs_url, status, conclusion, name, created_at\n"; const csvContent = workflowRuns.reduce((content, workflow) => { - const line = `${workflow.id}, ${workflow.jobs_url}, ${workflow.status}, ${workflow.conclusion}, ${workflow.name}, ${workflow.created_at}\n`; + const line = `${workflow.id}, ${workflow.jobs_url}, ${workflow.status}, ${ + workflow.conclusion + }, ${workflow.name}, ${formatCSVDate(new Date(workflow.created_at))}\n`; return content + line; }, CSV_HEADER); @@ -232,7 +248,13 @@ const getJobsFromWorkflows = async ( const workflowJobCount = workflowJobs.total_count; const workflowJobsContent = workflowJobs.jobs.reduce( (jobContent, job) => { - const line = `${workflowId}, ${workflowName}, ${workflowJobCount}, ${job.name}, ${job.started_at}, ${job.completed_at}\n`; + const line = `${ + job.id + }, ${workflowId}, ${workflowName}, ${workflowJobCount}, ${ + job.name + }, ${formatCSVDate(new Date(job.started_at))}, ${formatCSVDate( + new Date(job.completed_at) + )}\n`; return jobContent + line; }, From 6f21ab8c9c4a6a67b57f078162c827ac477452bb Mon Sep 17 00:00:00 2001 From: Adele Gauvrit Date: Wed, 30 Aug 2023 16:00:56 +0200 Subject: [PATCH 3/4] Ignore DS_Store --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 31f98b5..ac85b84 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ frontend/src/graphsData/*.json dist node_modules csvOutputs/*.csv +.DS_Store From 01bfa57688d9f3173239f3cef76716d3f67738b9 Mon Sep 17 00:00:00 2001 From: Adele Gauvrit Date: Wed, 30 Aug 2023 16:02:58 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=93=96=20Add=20template=20in=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7b4d49a..da895b6 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,5 @@ Run `yarn install` - Once the calculation is finished you can go in frontend folder and - `yarn install && yarn dev` - Go to the address provided by vite and TADA ! + +If you want to use the CSV export to make your own analysis, you can use this [google sheet template](https://docs.google.com/spreadsheets/d/1DeCE3kNkF2e_hpX67EYp0tB8GiAKgmKbLicC4ueDwIU)