Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cmd/update-rules/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ limitations under the License.
package main

import (
"bytes"
"flag"
"fmt"
"os"
"path/filepath"

"github.com/golang/glog"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
"k8s.io/publishing-bot/cmd/publishing-bot/config"
)

Expand Down Expand Up @@ -96,10 +97,14 @@ func main() {
glog.Fatalf("update failed, found invalid rules after update: %v", err)
}

data, err := yaml.Marshal(rules)
if err != nil {
var buf bytes.Buffer
enc := yaml.NewEncoder(&buf)
enc.SetIndent(2)
if err := enc.Encode(rules); err != nil {
glog.Fatalf("error marshaling rules %v", err)
}
_ = enc.Close()
data := buf.Bytes()

if o.out != "" {
err = exportRules(o.out, data)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
golang.org/x/oauth2 v0.31.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand Down