Loosen detection of web flow committer on GHES

Fixes #13848
This commit is contained in:
Markus Olsson 2022-02-09 10:17:08 +01:00
parent e9b6653a3a
commit 730ef46bbb

View file

@ -31,9 +31,19 @@ export function isWebFlowCommitter(
return true
}
if (name === 'GitHub Enterprise') {
const host = new URL(endpoint).host.toLowerCase()
return email.endsWith(`@${host}`)
if (endpoint !== getDotComAPIEndpoint() && name === 'GitHub Enterprise') {
// We can't assume that the email address will match any specific format
// here since the web flow committer email address on GHES is the same as
// the noreply email which can be configured by domain administrators so
// we'll just have to assume that for a GitHub hosted repository (but not
// GitHub.com) a commit author of the name 'GitHub Enterprise' is the web
// flow author.
//
// Hello future contributor: Turns out the web flow committer name is based
// on the "flavor" of GitHub so it's possible that you're here wondering why
// this isn't working and chances are it's because we've updated the
// GHES branding or introduced some new flavor.
return true
}
return false