Skip to content

add better error for pullRequestId being undefined #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions automagicallyexecute/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"ignorePatterns": ["node_modules"],
"rules": {
"i18n-text/no-en": "off",
"@typescript-eslint/no-floating-promises": "warn",
"prettier/prettier": "warn",
"no-console": "warn"
Expand Down
9 changes: 9 additions & 0 deletions automagicallyexecute/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ const run = async (): Promise<void> => {
pullRequestId: getVariable('System.PullRequest.PullRequestId')
}

if (!context.pullRequestId) {
setResult(
TaskResult.Failed,
'System.PullRequest.PullRequestId variable not available. ' +
'Make sure you run this task in a PR build validation pipeline, ' +
'otherwise we cannot comment back the test results'
)
}

debug(JSON.stringify({executeUrl, context}, null, 2))

// https://github.com/microsoft/azure-pipelines-task-lib/issues/579
Expand Down
2 changes: 1 addition & 1 deletion automagicallyexecute/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 1,
"Minor": 1,
"Patch": 1
"Patch": 2
},
"instanceNameFormat": "Execute Automagically",
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "automagically-execute-task",
"name": "octomind automagically execute",
"version": "1.1.1",
"version": "1.1.2",
"publisher": "octomind",
"targets": [
{
Expand Down