forked from OctoLinker/OctoLinker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for GitHub CODEOWNERS (OctoLinker#786)
* Add support for GitHub CODEOWNERS * remove e2e test
- Loading branch information
1 parent
c98adb2
commit edd1c4d
Showing
6 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# should ignore lines below | ||
|
||
* | ||
javascript/**/*.js @stefanbuck | ||
# /docker @stefanbuck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { join, dirname, extname } from 'path'; | ||
import relativeFile from '@octolinker/resolver-relative-file'; | ||
import resolverTrustedUrl from '@octolinker/resolver-trusted-url'; | ||
|
||
export default { | ||
name: 'GithubCodeowners', | ||
|
||
resolve(path, [target]) { | ||
if (target.endsWith('/**')) { | ||
target = target.replace('/**', ''); | ||
} | ||
|
||
if (target.endsWith('/*')) { | ||
target = target.replace('/*', ''); | ||
} | ||
|
||
if (target.includes('*')) { | ||
return ''; | ||
} | ||
|
||
if (target.startsWith('/')) { | ||
target = `.${target}`; | ||
} | ||
|
||
target = join('../', target); | ||
|
||
const basePath = join(dirname(path), target); | ||
const fileExt = extname(basePath); | ||
|
||
if (!fileExt) { | ||
return resolverTrustedUrl({ target: basePath }); | ||
} | ||
|
||
return relativeFile({ path, target }); | ||
}, | ||
|
||
getPattern() { | ||
return { | ||
pathRegexes: [/\.github\/CODEOWNERS$/], | ||
githubClasses: [], | ||
}; | ||
}, | ||
|
||
getLinkRegexes() { | ||
return /^([^\s#]+)/gm; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "@octolinker/plugin-github-codeowners", | ||
"version": "1.0.0", | ||
"description": "", | ||
"repository": "https://github.com/octolinker/octolinker/tree/master/packages/plugin-github-codeowners", | ||
"license": "MIT", | ||
"main": "./index.js", | ||
"dependencies": { | ||
"@octolinker/resolver-relative-file": "1.0.0", | ||
"@octolinker/resolver-trusted-url": "1.0.0", | ||
"@octolinker/helper-grammar-regex-collection": "1.0.0" | ||
} | ||
} |