forked from github/docs
-
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.
Catch deprecated GHAE flags in feature-based versioning (github#31097)
Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com>
- Loading branch information
1 parent
dfdd5b8
commit e0006ae
Showing
5 changed files
with
59 additions
and
33 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Reference: Issue #6996 ability to show users' first/last name instead of username in issue/PR comment titles for public and internal repos | ||
versions: | ||
ghes: '>=3.6' | ||
ghae: 'issue-6996' | ||
ghae: '>=3.6' |
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,27 @@ | ||
// lib/frontmatter contains a temporary check for presence of deprecated GHAE | ||
// feature flags in FM. See details in docs-internal#29178. | ||
// TODO: Remove that check and this cleanup kludge after GHAE semantic versioning | ||
// has been in place for a while. | ||
// | ||
// We need this kludge because if lib/frontmatter finds an old flag using the | ||
// 'pattern' check, the semver 'conform' check will also fail. Showing both errors would | ||
// be confusing for contributors, so we want to only show the pattern failure because it has | ||
// a helpful customized message. Due to a limitation of revalidator, it's not possible | ||
// to prefer one error over the other programmatically. So this function deletes the | ||
// conform error if a pattern error is found. | ||
export default function cleanUpDeprecatedGhaeFlagErrors(errors) { | ||
errors.forEach((error) => { | ||
if (error.property === 'versions.ghae' && error.attribute === 'pattern') { | ||
const currIndex = errors.indexOf(error) | ||
const prevIndex = currIndex - 1 // Hack to get the conform error, which comes before this one. | ||
|
||
// If this is a translated file, remove all errors on deprecated flags. | ||
// If this is an English file, remove the conform error. | ||
error.filepath?.includes('/translations/') | ||
? errors.splice(prevIndex, 2) | ||
: errors.splice(prevIndex, 1) | ||
} | ||
}) | ||
|
||
return errors | ||
} |
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