You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
We can update this to only link an ID when it's not part of the same repo. The below expression translates to: do not match if the preceding token is a string value.
…r characters
To avoid matching against issues in other repositories, we can reduce
our matches to not include values if they are preceded by 1 or more
string/number/hypen/underscore values.
Tested using:
- a JS console:
```javascript
const issueRegExp = new RegExp("(?<![A-Za-z\\-\\_]+)#(\\d+)+", "g");
const numMatches = Array.from(issueRegExp[Symbol.matchAll]("mozilla-mobile#12345")).length
const numMatches2 = Array.from(issueRegExp[Symbol.matchAll](" mozilla-mobile#12345 ")).length
assert(numMatches == 0);
assert(numMatches2 == 1);
```
- regex tester: https://regexr.com/6rg2v
To avoid matching against issues in other repositories, we can reduce
our matches to not include values if they are preceded by 1 or more
string/number/hypen/underscore values.
Tested using:
- a JS console:
```javascript
const issueRegExp = new RegExp("(?<![A-Za-z\\-\\_]+)#(\\d+)+", "g");
const numMatches = Array.from(issueRegExp[Symbol.matchAll]("#12345")).length
const numMatches2 = Array.from(issueRegExp[Symbol.matchAll](" #12345 ")).length
assert(numMatches == 0);
assert(numMatches2 == 1);
```
- regex tester: https://regexr.com/6rg2v
…tch issue ID if preceded by other characters
To avoid matching against issues in other repositories, we can reduce
our matches to not include values if they are preceded by 1 or more
string/number/hypen/underscore values.
Tested using:
- a JS console:
```javascript
const issueRegExp = new RegExp("(?<![A-Za-z\\-\\_]+)#(\\d+)+", "g");
const numMatches = Array.from(issueRegExp[Symbol.matchAll]("https://github.com/mozilla-mobile/android-components/issues/12345")).length
const numMatches2 = Array.from(issueRegExp[Symbol.matchAll](" mozilla-mobile/android-components#12345 ")).length
assert(numMatches == 0);
assert(numMatches2 == 1);
```
- regex tester: https://regexr.com/6rg2v
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We're using a simple regex here for grabbing the linked issue that will find any issue ID, regardless of repo:
android-components/.github/workflows/issue-linker.yml
Line 20 in 86112e3
We can update this to only link an ID when it's not part of the same repo. The below expression translates to: do not match if the preceding token is a string value.
Regex evaluator with tests: https://regexr.com/6rg2v
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: