-
Notifications
You must be signed in to change notification settings - Fork 1
/
report.js
34 lines (29 loc) · 890 Bytes
/
report.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const util = require('util')
const fs = require('fs')
const webpack = require('webpack')
const PacktrackerPlugin = require('@packtracker/webpack-plugin')
const event = require(process.env.GITHUB_EVENT_PATH)
console.log(util.inspect(event))
let config = {}
if (fs.lstatSync(process.env.WEBPACK_CONFIG_PATH).isFile()) {
config = require(process.env.WEBPACK_CONFIG_PATH)
}
const pt_config = {
upload: true,
fail_build: true,
branch: event.ref.replace('refs/heads/', ''),
author: event.head_commit.author.email,
message: event.head_commit.message,
commit: process.env.GITHUB_SHA,
committed_at: parseInt(+new Date(event.head_commit.timestamp) / 1000),
prior_commit: event.before,
}
config.plugins = config.plugins || []
config.plugins.push(new PacktrackerPlugin(pt_config))
webpack(config, (err) => {
if (err) {
process.exit(1)
} else {
process.exit(0)
}
})