Skip to content

Commit

Permalink
Team Labeler dependency updates (#10)
Browse files Browse the repository at this point in the history
* feat: ignore case when matching yml configuration to GitHub author (JulienKode#216)

* chore(deps): update dependency eslint to v8.56.0 (JulienKode#218)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @typescript-eslint/parser to v5.62.0 (JulienKode#215)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @types/js-yaml to v4.0.9 (JulienKode#213)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @types/node to v18.19.4 (JulienKode#214)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @types/jest to v29.5.11 (JulienKode#212)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @vercel/ncc to v0.38.1 (JulienKode#217)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

---------

Co-authored-by: Benjamin Raymond <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 1, 2024
1 parent e3dbfde commit 66bfc0d
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 134 deletions.
13 changes: 13 additions & 0 deletions __tests__/teams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ test('Should add team label when the author is found', () => {
expect(output).toEqual(['LightSide'])
})

test('Should be able to detect users with different username casings', () => {
// Given
const author = '@Anakin'
const labelGlobs = new Map<string, string[]>()
labelGlobs.set('LightSide', ['@Yoda', '@ANAKIN'])

// When
const output = getTeamLabel(labelGlobs, author)

// Expect
expect(output).toEqual(['LightSide'])
})

test('Should be able to detect when a user is in multiple teams', () => {
// Given
const author = '@Anakin'
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
"js-yaml": "4.1.0"
},
"devDependencies": {
"@types/jest": "29.5.5",
"@types/js-yaml": "4.0.7",
"@types/node": "18.18.4",
"@typescript-eslint/parser": "5.58.0",
"@vercel/ncc": "0.36.1",
"eslint": "8.38.0",
"@types/jest": "29.5.11",
"@types/js-yaml": "4.0.9",
"@types/node": "18.19.4",
"@typescript-eslint/parser": "5.62.0",
"@vercel/ncc": "0.38.1",
"eslint": "8.56.0",
"eslint-plugin-github": "4.7.0",
"eslint-plugin-jest": "27.4.2",
"eslint-plugin-prettier": "4.2.1",
Expand Down
6 changes: 4 additions & 2 deletions src/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ export function getTeamLabel(
author: string
): string[] {
const labels: string[] = []
for (const [label, authors] of labelsConfiguration.entries())
if (authors.includes(author)) labels.push(label)
for (const [label, authors] of labelsConfiguration.entries()) {
if (authors.some(a => a.toLowerCase() === author.toLowerCase()))
labels.push(label)
}
return labels
}
Loading

0 comments on commit 66bfc0d

Please sign in to comment.