redir-gen does not ignore archived repo anymore (#4165)

This commit is contained in:
Lionel Villard 2021-08-27 09:05:38 -04:00 committed by GitHub
parent 21ccfd16ca
commit e867502fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 8 deletions

View File

@ -11,6 +11,7 @@
/build-spike/* go-get=1 /golang/build-spike.html 200
/caching/* go-get=1 /golang/caching.html 200
/client/* go-get=1 /golang/client.html 200
/client-pkg/* go-get=1 /golang/client-pkg.html 200
/community/* go-get=1 /golang/community.html 200
/control-protocol/* go-get=1 /golang/control-protocol.html 200
/discovery/* go-get=1 /golang/discovery.html 200

4
golang/client-pkg.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/client-pkg git https://github.com/knative/client-pkg">
<meta name="go-source" content="knative.dev/client-pkg https://github.com/knative/client-pkg https://github.com/knative/client-pkg/tree/main{/dir} https://github.com/knative/client-pkg/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -1,4 +0,0 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-camel git https://github.com/knative-sandbox/eventing-camel">
<meta name="go-source" content="knative.dev/eventing-camel https://github.com/knative-sandbox/eventing-camel https://github.com/knative-sandbox/eventing-camel/tree/main{/dir} https://github.com/knative-sandbox/eventing-camel/blob/main{/dir}/{file}#L{line}">
</head></html>

13
tools/redir-gen/README.md Normal file
View File

@ -0,0 +1,13 @@
# Regenerate /golang instructions
1. Install `redir-gen`
```sh
go get knative.dev/website/tools/redir-gen
```
2. From `docs` root directory, run `redir-gen`
```sh
$ redir-gen
```

View File

@ -28,8 +28,9 @@ import (
)
var (
knativeOrgs = []string{"knative", "knative-sandbox"}
allowedRepoRe = regexp.MustCompile("^[a-z][-a-z0-9]+$")
knativeOrgs = []string{"knative", "knative-sandbox"}
allowedRepoRe = regexp.MustCompile("^[a-z][-a-z0-9]+$")
archivedExceptions = []string{"eventing-contrib"}
)
// repoInfo provides a simple holder for GitHub repo information needed to
@ -80,7 +81,7 @@ func fetchRepos(orgs []string) ([]repoInfo, error) {
log.Printf("Ignoring repo %s, matched by ignore %q", *r.Name, allowedRepoRe)
continue
}
if *r.Archived {
if *r.Archived && !inArchivedExceptions(*r.Name) {
log.Print("Ignoring archived repo: ", *r.Name)
continue
}
@ -180,5 +181,13 @@ func (ris riSlice) Less(i, j int) bool {
func (ris riSlice) Swap(i, j int) {
ris[i], ris[j] = ris[j], ris[i]
}
func inArchivedExceptions(n string) bool {
for _, r := range archivedExceptions {
if r == n {
return true
}
}
return false
}