From f7f8dbaddf3868f88511cc091724ade373bc735b Mon Sep 17 00:00:00 2001
From: Danny McCormick <damccorm@microsoft.com>
Date: Mon, 8 Jul 2019 14:43:29 -0400
Subject: [PATCH] Add matcher

---
 .github/python.json | 16 ++++++++++++++++
 lib/setup-python.js |  3 +++
 src/setup-python.ts |  3 +++
 3 files changed, 22 insertions(+)
 create mode 100644 .github/python.json

diff --git a/.github/python.json b/.github/python.json
new file mode 100644
index 0000000..8232713
--- /dev/null
+++ b/.github/python.json
@@ -0,0 +1,16 @@
+{
+    "problemMatcher": [
+        {
+            "owner": "python",
+            "pattern": [
+                {
+                    "regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)\\s*raise\\s(.*)\\(\\'(.*)\\'\\)\\s*(.*)\\:\\s.*$",
+                    "file": 1,
+                    "line": 2,
+                    "severity": 4,
+                    "message": 5
+                }
+            ]
+        }
+    ]
+}
diff --git a/lib/setup-python.js b/lib/setup-python.js
index a2e5222..7b7fe07 100644
--- a/lib/setup-python.js
+++ b/lib/setup-python.js
@@ -17,6 +17,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
 Object.defineProperty(exports, "__esModule", { value: true });
 const core = __importStar(require("@actions/core"));
 const finder = __importStar(require("./find-python"));
+const path = __importStar(require("path"));
 function run() {
     return __awaiter(this, void 0, void 0, function* () {
         try {
@@ -25,6 +26,8 @@ function run() {
                 const arch = core.getInput('architecture', { required: true });
                 yield finder.findPythonVersion(version, arch);
             }
+            const matchersPath = path.join(__dirname, '..', '.github');
+            console.log(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
         }
         catch (err) {
             core.setFailed(err.message);
diff --git a/src/setup-python.ts b/src/setup-python.ts
index 746c824..68540d8 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -1,5 +1,6 @@
 import * as core from '@actions/core';
 import * as finder from './find-python';
+import * as path from 'path';
 
 async function run() {
   try {
@@ -8,6 +9,8 @@ async function run() {
       const arch: string = core.getInput('architecture', {required: true});
       await finder.findPythonVersion(version, arch);
     }
+    const matchersPath = path.join(__dirname, '..', '.github');
+    console.log(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
   } catch (err) {
     core.setFailed(err.message);
   }