Skip to content

Commit 3f31966

Browse files
committed
feat: pass target url
1 parent d76ba0e commit 3f31966

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

bin/set-commit-status.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const args = require('minimist')(allArgs, {
1111
sha: 'commit',
1212
description: 'd'
1313
},
14-
string: ['file', 'sha', 'state', 'label', 'description']
14+
string: ['file', 'sha', 'state', 'label', 'description', 'url']
1515
})
1616

1717
const api = require('..')
@@ -51,6 +51,6 @@ start
5151
throw new Error('missing "context" property on status object')
5252
}
5353

54-
return setCommitStatus(args.state, args.description, status)
54+
return setCommitStatus(args.state, args.description, status, args.url)
5555
})
5656
.catch(onError)

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"stub-spawn-once": "2.3.0"
9292
},
9393
"dependencies": {
94-
"@cypress/set-commit-status": "1.2.0",
94+
"@cypress/set-commit-status": "1.3.0",
9595
"chalk": "2.4.2",
9696
"check-more-types": "2.24.0",
9797
"debug": "4.1.1",

src/index.js

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

139-
function setCommitStatus (state, description, status) {
139+
function setCommitStatus (state, description, status, targetUrl) {
140140
la(is.maybe.unemptyString(description), 'invalid description', description)
141141

142142
const isValidState = is.oneOf(['error', 'pending', 'failure', 'success'])
@@ -146,15 +146,19 @@ function setCommitStatus (state, description, status) {
146146
console.log('setting status for commit %s', status.sha)
147147
console.log('context: %s', context)
148148
console.log('state: %s', state)
149+
if (targetUrl) {
150+
console.log('target url: %s', targetUrl)
151+
la(is.webUrl(targetUrl), 'expected target url, got', targetUrl)
152+
}
149153

150-
// TODO: pass targetUrl
151154
const options = {
152155
owner: status.owner,
153156
repo: status.repo,
154157
sha: status.sha,
155158
state,
156159
context,
157-
description
160+
description,
161+
targetUrl
158162
}
159163

160164
debug('setting commit status %o', options)

0 commit comments

Comments
 (0)