fix(healthcheck/forbidden): new hints
All checks were successful
build / build (pull_request) Successful in 1m8s
build / build (push) Successful in 1m6s
build / trigger-build-image (push) Has been skipped
build / trigger-build-image (pull_request) Has been skipped

This commit is contained in:
张泊明518370910136 2024-10-14 10:14:32 -04:00
parent 018bfbf8e5
commit f6e7ea73bd
GPG Key ID: D47306D7062CDA9D

View File

@ -78,8 +78,17 @@ func ForbiddenCheck(rootDir string, regexList []string, localList string) error
} }
if len(forbids) > 0 { if len(forbids) > 0 {
return fmt.Errorf("The following forbidden files were found: `%s`\n", return fmt.Errorf("The following forbidden files were found: `%s`\n\n"+
strings.Join(forbids, "`, `")) "To fix it, first make a backup of your repository and then run the following commands:\n"+
"```bash\n"+
"export GIT_BRANCH=$(git branch --show-current)\n"+
"export GIT_REMOTE_URL=$(git config --get remote.origin.url)\n"+
"for i in %s; do git filter-repo --force --invert-paths --path \"$i\"; done\n"+
"git remote add origin $GIT_REMOTE_URL\n"+
"git push --set-upstream origin $GIT_BRANCH --force\n"+
"```\n",
strings.Join(forbids, "`, `"),
strings.Join(forbids, " "))
} }
return nil return nil
} }