@@ -4,7 +4,7 @@ const core = require('@actions/core');
4
4
const token = process . env . NETLIFY_TOKEN || core . getInput ( 'netlify-token' , { required : true } ) ;
5
5
const siteId = process . env . NETLIFY_SITE_ID || core . getInput ( 'netlify-site-id' , { required : true } ) ;
6
6
const days = process . env . DAYS || core . getInput ( 'days' ) ;
7
- const header = process . env . DISABLEHEADER === "true" || core . getInput ( 'disable-header' ) === "true" ;
7
+ const disableHeader = process . env . DISABLEHEADER === "true" || core . getInput ( 'disable-header' ) === "true" ;
8
8
9
9
const startDate = new Date ( ) ;
10
10
startDate . setUTCHours ( 0 ) ;
@@ -74,14 +74,22 @@ function writeToCSV(data, metric) {
74
74
let header = [ ] ;
75
75
try {
76
76
if ( data [ 0 ] instanceof Array ) {
77
- header = [
78
- { id : 'date' , title : 'date' } ,
79
- { id : 'timestamp' , title : 'timestamp' } ,
80
- { id : 'value' , title : 'count' } ,
81
- ] ;
77
+ if ( disableHeader ) {
78
+ header = [ 'date' , 'timestamp' , 'value' ] ;
79
+ } else {
80
+ header = [
81
+ { id : 'date' , title : 'date' } ,
82
+ { id : 'timestamp' , title : 'timestamp' } ,
83
+ { id : 'value' , title : 'count' } ,
84
+ ] ;
85
+ }
82
86
} else {
83
87
for ( const key in data [ 0 ] ) {
84
- header . push ( { id : key , title : key } ) ;
88
+ if ( disableHeader ) {
89
+ header . push ( key ) ;
90
+ } else {
91
+ header . push ( { id : key , title : key } ) ;
92
+ }
85
93
}
86
94
}
87
95
} catch ( e ) {
0 commit comments