Initial commit
This commit is contained in:
17
src/gcc_matcher.jsontemplate
Normal file
17
src/gcc_matcher.jsontemplate
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "gcc-problem-matcher",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^${{ BASE }}\/?(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
33
src/index.js
Normal file
33
src/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const path = require('path');
|
||||
const fs = require('node:fs');
|
||||
//const core = require('@actions/core');
|
||||
|
||||
// C:\Users\ => C\:\\Users\\
|
||||
const escapeRegExp = (s) =>
|
||||
s.replace(/[:.*+?^${}()|\/[\]\\]/g, "\\$&");
|
||||
|
||||
|
||||
// ${{ key }}, ${{var}}, ${{ aggqq43g3qg4 }}
|
||||
const variable = (key) =>
|
||||
new RegExp("\\${{\\s*?" + key + "\\s*?}}", "g");
|
||||
|
||||
|
||||
// default value set in /action.yml
|
||||
// const root = core.getInput('root', { required: false });
|
||||
root = '/tmp/workspace';
|
||||
|
||||
const templatePath = path.join(__dirname, "gcc_matcher.jsontemplate");
|
||||
|
||||
const parsed =
|
||||
fs.readFileSync(templatePath, "ascii")
|
||||
.replace(variable("BASE"), escapeRegExp(root));
|
||||
|
||||
const matcherPath = path.join(__dirname, "gcc_matcher.json");
|
||||
|
||||
fs.writeFileSync(matcherPath, parsed);
|
||||
|
||||
console.log('::add-matcher::' + matcherPath);
|
||||
|
||||
/* for testing */
|
||||
exports.escapeRegExp = escapeRegExp
|
||||
exports.variable = variable;
|
||||
Reference in New Issue
Block a user