Skip to content

Commit 5061673

Browse files
add better error for pullRequestId being undefined (#5)
* add better error for pullRequestId being undefined * version bump * PR comment
1 parent fb011a4 commit 5061673

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

automagicallyexecute/.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"ignorePatterns": ["node_modules"],
1313
"rules": {
14+
"i18n-text/no-en": "off",
1415
"@typescript-eslint/no-floating-promises": "warn",
1516
"prettier/prettier": "warn",
1617
"no-console": "warn"

automagicallyexecute/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ const run = async (): Promise<void> => {
4040
pullRequestId: getVariable('System.PullRequest.PullRequestId')
4141
}
4242

43+
if (!context.pullRequestId) {
44+
setResult(
45+
TaskResult.Failed,
46+
'System.PullRequest.PullRequestId variable not available. ' +
47+
'Make sure you run this task in a PR build validation pipeline, ' +
48+
'otherwise we cannot comment back the test results'
49+
)
50+
}
51+
4352
debug(JSON.stringify({executeUrl, context}, null, 2))
4453

4554
// https://github.com/microsoft/azure-pipelines-task-lib/issues/579

automagicallyexecute/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": {
1010
"Major": 1,
1111
"Minor": 1,
12-
"Patch": 1
12+
"Patch": 2
1313
},
1414
"instanceNameFormat": "Execute Automagically",
1515
"inputs": [

vss-extension.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifestVersion": 1,
33
"id": "automagically-execute-task",
44
"name": "octomind automagically execute",
5-
"version": "1.1.1",
5+
"version": "1.1.2",
66
"publisher": "octomind",
77
"targets": [
88
{

0 commit comments

Comments
 (0)