@@ -5,20 +5,20 @@ const find = require('lodash/find')
55const round = require ( 'lodash/round' )
66const fs = require ( 'fs/promises' )
77const { DateTime } = require ( 'luxon' )
8- const isPlainObject = require ( 'lodash/isPlainObject' )
8+ // const isPlainObject = require('lodash/isPlainObject')
99
1010const dec = new TextDecoder ( )
1111
1212async function main ( ) {
1313 const token = core . getInput ( 'token' )
14- const tokenCommon = core . getInput ( 'tokenCommon' )
14+ // const tokenCommon = core.getInput('tokenCommon')
1515 const inputCovPath = core . getInput ( 'coverageResultsPath' ) // 'data/coverage-raw.json'
1616 const outputCovPath = core . getInput ( 'coverageResultsPath' ) // 'data/coverage.json'
1717 const outputHistPath = core . getInput ( 'histCoveragePath' ) // 'data/historical-coverage.json'
1818 const relVersionRaw = core . getInput ( 'version' ) // 'v7.47.0'
1919 const relVersion = relVersionRaw . indexOf ( 'v' ) === 0 ? relVersionRaw . substring ( 1 ) : relVersionRaw
2020 const gh = github . getOctokit ( token )
21- const ghCommon = github . getOctokit ( tokenCommon )
21+ // const ghCommon = github.getOctokit(tokenCommon)
2222 const owner = github . context . repo . owner // 'ietf-tools'
2323 const repo = github . context . repo . repo // 'datatracker'
2424 const sender = github . context . payload . sender . login // 'rjsparks'
@@ -116,137 +116,137 @@ async function main () {
116116 }
117117
118118 // -> Coverage Chart
119- if ( chartsDirListing . some ( c => c . name === `${ newRelease . id } .svg` ) ) {
120- console . info ( `Chart SVG already exists for ${ newRelease . name } , skipping...` )
121- } else {
122- console . info ( `Generating chart SVG for ${ newRelease . name } ...` )
119+ // if (chartsDirListing.some(c => c.name === `${newRelease.id}.svg`)) {
120+ // console.info(`Chart SVG already exists for ${newRelease.name}, skipping...`)
121+ // } else {
122+ // console.info(`Generating chart SVG for ${newRelease.name}...`)
123123
124- const { ChartJSNodeCanvas } = require ( 'chartjs-node-canvas' )
125- const chartJSNodeCanvas = new ChartJSNodeCanvas ( { type : 'svg' , width : 850 , height : 300 , backgroundColour : '#FFFFFF' } )
124+ // const { ChartJSNodeCanvas } = require('chartjs-node-canvas')
125+ // const chartJSNodeCanvas = new ChartJSNodeCanvas({ type: 'svg', width: 850, height: 300, backgroundColour: '#FFFFFF' })
126126
127- // -> Reorder versions
128- const versions = [ ]
129- for ( const [ key , value ] of Object . entries ( covData ) ) {
130- if ( isPlainObject ( value ) ) {
131- const vRel = find ( releases , r => r . tag_name === key || r . tag_name === `v${ key } ` )
132- if ( ! vRel ) {
133- continue
134- }
135- versions . push ( {
136- tag : key ,
137- time : vRel . created_at ,
138- stats : {
139- code : round ( value . code * 100 , 2 ) ,
140- template : round ( value . template * 100 , 2 ) ,
141- url : round ( value . url * 100 , 2 )
142- }
143- } )
144- }
145- }
146- const roVersions = orderBy ( versions , [ 'time' , 'tag' ] , [ 'asc' , 'asc' ] )
127+ // // -> Reorder versions
128+ // const versions = []
129+ // for (const [key, value] of Object.entries(covData)) {
130+ // if (isPlainObject(value)) {
131+ // const vRel = find(releases, r => r.tag_name === key || r.tag_name === `v${key}`)
132+ // if (!vRel) {
133+ // continue
134+ // }
135+ // versions.push({
136+ // tag: key,
137+ // time: vRel.created_at,
138+ // stats: {
139+ // code: round(value.code * 100, 2),
140+ // template: round(value.template * 100, 2),
141+ // url: round(value.url * 100, 2)
142+ // }
143+ // })
144+ // }
145+ // }
146+ // const roVersions = orderBy(versions, ['time', 'tag'], ['asc', 'asc'])
147147
148- // -> Fill axis + data points
149- const labels = [ ]
150- const datasetCode = [ ]
151- const datasetTemplate = [ ]
152- const datasetUrl = [ ]
148+ // // -> Fill axis + data points
149+ // const labels = []
150+ // const datasetCode = []
151+ // const datasetTemplate = []
152+ // const datasetUrl = []
153153
154- for ( const ver of roVersions ) {
155- labels . push ( ver . tag )
156- datasetCode . push ( ver . stats . code )
157- datasetTemplate . push ( ver . stats . template )
158- datasetUrl . push ( ver . stats . url )
159- }
154+ // for (const ver of roVersions) {
155+ // labels.push(ver.tag)
156+ // datasetCode.push(ver.stats.code)
157+ // datasetTemplate.push(ver.stats.template)
158+ // datasetUrl.push(ver.stats.url)
159+ // }
160160
161- // -> Generate chart SVG
162- const outputStream = chartJSNodeCanvas . renderToBufferSync ( {
163- type : 'line' ,
164- options : {
165- borderColor : '#CCC' ,
166- layout : {
167- padding : 20
168- } ,
169- plugins : {
170- legend : {
171- position : 'bottom' ,
172- labels : {
173- font : {
174- size : 11
175- }
176- }
177- }
178- } ,
179- scales : {
180- x : {
181- ticks : {
182- font : {
183- size : 10
184- }
185- }
186- } ,
187- y : {
188- ticks : {
189- callback : ( value ) => {
190- return `${ value } %`
191- } ,
192- font : {
193- size : 10
194- }
195- }
196- }
197- }
198- } ,
199- data : {
200- labels,
201- datasets : [
202- {
203- label : 'Code' ,
204- data : datasetCode ,
205- borderWidth : 2 ,
206- borderColor : '#E53935' ,
207- backgroundColor : '#C6282833' ,
208- fill : false ,
209- cubicInterpolationMode : 'monotone' ,
210- tension : 0.4 ,
211- pointRadius : 0
212- } ,
213- {
214- label : 'Templates' ,
215- data : datasetTemplate ,
216- borderWidth : 2 ,
217- borderColor : '#039BE5' ,
218- backgroundColor : '#0277BD33' ,
219- fill : false ,
220- cubicInterpolationMode : 'monotone' ,
221- tension : 0.4 ,
222- pointRadius : 0
223- } ,
224- {
225- label : 'URLs' ,
226- data : datasetUrl ,
227- borderWidth : 2 ,
228- borderColor : '#7CB342' ,
229- backgroundColor : '#558B2F33' ,
230- fill : false ,
231- cubicInterpolationMode : 'monotone' ,
232- tension : 0.4 ,
233- pointRadius : 0
234- }
235- ]
236- }
237- } , 'image/svg+xml' )
238- const svg = Buffer . from ( outputStream ) . toString ( 'base64' )
161+ // // -> Generate chart SVG
162+ // const outputStream = chartJSNodeCanvas.renderToBufferSync({
163+ // type: 'line',
164+ // options: {
165+ // borderColor: '#CCC',
166+ // layout: {
167+ // padding: 20
168+ // },
169+ // plugins: {
170+ // legend: {
171+ // position: 'bottom',
172+ // labels: {
173+ // font: {
174+ // size: 11
175+ // }
176+ // }
177+ // }
178+ // },
179+ // scales: {
180+ // x: {
181+ // ticks: {
182+ // font: {
183+ // size: 10
184+ // }
185+ // }
186+ // },
187+ // y: {
188+ // ticks: {
189+ // callback: (value) => {
190+ // return `${value}%`
191+ // },
192+ // font: {
193+ // size: 10
194+ // }
195+ // }
196+ // }
197+ // }
198+ // },
199+ // data: {
200+ // labels,
201+ // datasets: [
202+ // {
203+ // label: 'Code',
204+ // data: datasetCode,
205+ // borderWidth: 2,
206+ // borderColor: '#E53935',
207+ // backgroundColor: '#C6282833',
208+ // fill: false,
209+ // cubicInterpolationMode: 'monotone',
210+ // tension: 0.4,
211+ // pointRadius: 0
212+ // },
213+ // {
214+ // label: 'Templates',
215+ // data: datasetTemplate,
216+ // borderWidth: 2,
217+ // borderColor: '#039BE5',
218+ // backgroundColor: '#0277BD33',
219+ // fill: false,
220+ // cubicInterpolationMode: 'monotone',
221+ // tension: 0.4,
222+ // pointRadius: 0
223+ // },
224+ // {
225+ // label: 'URLs',
226+ // data: datasetUrl,
227+ // borderWidth: 2,
228+ // borderColor: '#7CB342',
229+ // backgroundColor: '#558B2F33',
230+ // fill: false,
231+ // cubicInterpolationMode: 'monotone',
232+ // tension: 0.4,
233+ // pointRadius: 0
234+ // }
235+ // ]
236+ // }
237+ // }, 'image/svg+xml')
238+ // const svg = Buffer.from(outputStream).toString('base64')
239239
240- // -> Upload to common repo
241- console . info ( `Uploading chart SVG for ${ newRelease . name } ...` )
242- await ghCommon . rest . repos . createOrUpdateFileContents ( {
243- owner,
244- repo : repoCommon ,
245- path : `assets/graphs/datatracker/${ newRelease . id } .svg` ,
246- message : `chore: update datatracker release chart for release ${ newRelease . name } ` ,
247- content : svg
248- } )
249- }
240+ // // -> Upload to common repo
241+ // console.info(`Uploading chart SVG for ${newRelease.name}...`)
242+ // await ghCommon.rest.repos.createOrUpdateFileContents({
243+ // owner,
244+ // repo: repoCommon,
245+ // path: `assets/graphs/datatracker/${newRelease.id}.svg`,
246+ // message: `chore: update datatracker release chart for release ${newRelease.name}`,
247+ // content: svg
248+ // })
249+ // }
250250
251251 // -> Add to changelog body
252252 let formattedBody = ''
@@ -265,7 +265,7 @@ async function main () {
265265 formattedBody += ` } ?style=flat-square)`
266266 formattedBody += ` } ?style=flat-square)`
267267 formattedBody += ` } ?style=flat-square)\n\n`
268- formattedBody += ``
268+ // formattedBody += ``
269269
270270 core . setOutput ( 'changelog' , formattedBody )
271271}
0 commit comments