Skip to content

Commit

Permalink
Add calens check to verify changelog entries in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Aug 11, 2020
1 parent fd1ac13 commit 0407018
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/calens-check-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Add calens check to verify changelog entries in CI

https://github.com/cs3org/reva/pull/1077
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ require (
github.com/ory/fosite v0.32.2
github.com/pkg/errors v0.9.1
github.com/pkg/xattr v0.4.1
github.com/restic/calens v0.2.0
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/prometheus/client_golang v1.7.1
github.com/rs/cors v1.7.0
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/statsd_exporter v0.15.0 h1:UiwC1L5HkxEPeapXdm2Ye0u1vUJfTj7uwT5yydYpa1E=
github.com/prometheus/statsd_exporter v0.15.0/go.mod h1:Dv8HnkoLQkeEjkIE4/2ndAA7WL1zHKK7WMqFQqu72rw=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/restic/calens v0.2.0/go.mod h1:UXwyAKS4wsgUZGEc7NrzzygJbLsQZIo3wl+62Q1wvmU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.0.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
Expand Down
20 changes: 15 additions & 5 deletions tools/check-changelog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"errors"
"flag"
"fmt"
"log"
"os"
"os/exec"
Expand Down Expand Up @@ -62,18 +63,27 @@ func main() {
prID := flag.Int("pr", 0, "the ID of the PR")
flag.Parse()

if *prID > 0 {
if skipPR(*prID) {
return
}
if *prID > 0 && skipPR(*prID) {
return
}

gopath, err := exec.Command("go", "env", "GOPATH").Output()
if err != nil {
log.Fatal(err)
}
calensBin := fmt.Sprintf("%s/bin/calens", strings.TrimSpace(string(gopath)))
calensCmd := exec.Command(calensBin)
out, err := calensCmd.CombinedOutput()
if err != nil {
log.Fatalf("calens failed with %s\n%s", err, out)
}

branch := "master"
if *repo != "" {
branch = *repo + "/master"
}
cmd := exec.Command("git", "diff-index", branch, "--", "changelog/unreleased")
out, err := cmd.Output()
out, err = cmd.Output()
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 0407018

Please sign in to comment.