Skip to content

Commit 563c983

Browse files
committed
fix: pass context correctly to set-commit-status
- require that this be passed in from the parsed commit message install
1 parent 467535f commit 563c983

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

bin/set-commit-status.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
'use strict'
44

55
const debug = require('debug')('commit-message-install')
6-
const os = require('os')
7-
const path = require('path')
86

97
const allArgs = process.argv.slice(2)
108
const args = require('minimist')(allArgs, {
@@ -49,11 +47,10 @@ start
4947
return
5048
}
5149

52-
if (!args.label) {
53-
const name = require(path.join(process.cwd(), 'package.json')).name
54-
args.label = `${os.platform()}-${os.arch()} ${name}`
50+
if (!status.context) {
51+
throw new Error('missing "context" property on status object')
5552
}
5653

57-
return setCommitStatus(args.label, args.state, args.description, status)
54+
return setCommitStatus(args.state, args.description, status)
5855
})
5956
.catch(onError)

src/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,13 @@ function getCommand (args) {
136136
return command
137137
}
138138

139-
function setCommitStatus (label, state, description, status) {
140-
la(is.unemptyString(label), 'missing label to put into the context', label)
139+
function setCommitStatus (state, description, status) {
141140
la(is.maybe.unemptyString(description), 'invalid description', description)
142141

143142
const isValidState = is.oneOf(['error', 'pending', 'failure', 'success'])
144143
la(isValidState(state), 'invalid commit state to set', state)
145144

146-
const context = label
145+
const context = status.context
147146
console.log('setting status for commit %s', status.sha)
148147
console.log('context: %s', context)
149148
console.log('state: %s', state)

0 commit comments

Comments
 (0)