Skip to content

Commit

Permalink
Close mozilla-mobile#12623: Do not match issue ID if preceded by othe…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
jonalmeida committed Aug 9, 2022
1 parent 86112e3 commit 4a9c1be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/issue-linker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
uses: gabrielluong/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-regexp: "#(\\d+)+"
commit-regexp: "(?<![A-Za-z\\-\\_]+)#(\\d+)+"
section: "### GitHub Automation"

0 comments on commit 4a9c1be

Please sign in to comment.