refactor: rename script
This commit is contained in:
parent
36ebd8d68b
commit
c3f998dbd9
@ -21,7 +21,7 @@ type directoryReadme struct {
|
|||||||
RawText string
|
RawText string
|
||||||
}
|
}
|
||||||
|
|
||||||
type rawContributorProfileFrontmatter struct {
|
type contributorProfileFrontmatter struct {
|
||||||
DisplayName string `yaml:"display_name"`
|
DisplayName string `yaml:"display_name"`
|
||||||
Bio string `yaml:"bio"`
|
Bio string `yaml:"bio"`
|
||||||
GithubUsername string `yaml:"github"`
|
GithubUsername string `yaml:"github"`
|
||||||
@ -33,8 +33,8 @@ type rawContributorProfileFrontmatter struct {
|
|||||||
ContributorStatus *string `yaml:"status"`
|
ContributorStatus *string `yaml:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type contributorFrontmatterWithFilepath struct {
|
type contributorFrontmatterWithFilePath struct {
|
||||||
rawContributorProfileFrontmatter
|
contributorProfileFrontmatter
|
||||||
FilePath string
|
FilePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ func extractFrontmatter(readmeText string) (string, error) {
|
|||||||
return fm, nil
|
return fm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateContributorYaml(yml contributorFrontmatterWithFilepath) []error {
|
func validateContributorYaml(yml contributorFrontmatterWithFilePath) []error {
|
||||||
// This function needs to aggregate a bunch of different problems, rather
|
// This function needs to aggregate a bunch of different problems, rather
|
||||||
// than stopping at the first one found, so using code blocks to section off
|
// than stopping at the first one found, so using code blocks to section off
|
||||||
// logic for different fields
|
// logic for different fields
|
||||||
@ -365,10 +365,10 @@ func validateContributorYaml(yml contributorFrontmatterWithFilepath) []error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseContributorFiles(readmeEntries []directoryReadme) (
|
func parseContributorFiles(readmeEntries []directoryReadme) (
|
||||||
map[string]contributorFrontmatterWithFilepath,
|
map[string]contributorFrontmatterWithFilePath,
|
||||||
error,
|
error,
|
||||||
) {
|
) {
|
||||||
frontmatterByUsername := map[string]contributorFrontmatterWithFilepath{}
|
frontmatterByUsername := map[string]contributorFrontmatterWithFilePath{}
|
||||||
yamlParsingErrors := workflowPhaseError{
|
yamlParsingErrors := workflowPhaseError{
|
||||||
Phase: "YAML parsing",
|
Phase: "YAML parsing",
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ func parseContributorFiles(readmeEntries []directoryReadme) (
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
yml := rawContributorProfileFrontmatter{}
|
yml := contributorProfileFrontmatter{}
|
||||||
if err := yaml.Unmarshal([]byte(fm), &yml); err != nil {
|
if err := yaml.Unmarshal([]byte(fm), &yml); err != nil {
|
||||||
yamlParsingErrors.Errors = append(
|
yamlParsingErrors.Errors = append(
|
||||||
yamlParsingErrors.Errors,
|
yamlParsingErrors.Errors,
|
||||||
@ -390,9 +390,9 @@ func parseContributorFiles(readmeEntries []directoryReadme) (
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
processed := contributorFrontmatterWithFilepath{
|
processed := contributorFrontmatterWithFilePath{
|
||||||
FilePath: rm.FilePath,
|
FilePath: rm.FilePath,
|
||||||
rawContributorProfileFrontmatter: yml,
|
contributorProfileFrontmatter: yml,
|
||||||
}
|
}
|
||||||
|
|
||||||
if prev, conflict := frontmatterByUsername[processed.GithubUsername]; conflict {
|
if prev, conflict := frontmatterByUsername[processed.GithubUsername]; conflict {
|
||||||
@ -500,7 +500,7 @@ func aggregateReadmeFiles() ([]directoryReadme, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func validateRelativeUrls(
|
func validateRelativeUrls(
|
||||||
contributors map[string]contributorFrontmatterWithFilepath,
|
contributors map[string]contributorFrontmatterWithFilePath,
|
||||||
) error {
|
) error {
|
||||||
// This function only validates relative avatar URLs for now, but it can be
|
// This function only validates relative avatar URLs for now, but it can be
|
||||||
// beefed up to validate more in the future
|
// beefed up to validate more in the future
|
||||||
Loading…
x
Reference in New Issue
Block a user