Skip to content

Commit 6583af3

Browse files
authored
Merge pull request #3639 from saschagrunert/skip-first-commit
release-notes: add `--skip-first-commit`/`-s` option
2 parents 09c6ce2 + 45a9b7a commit 6583af3

File tree

10 files changed

+78
-52
lines changed

10 files changed

+78
-52
lines changed

cmd/release-notes/README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,32 +69,33 @@ level=debug timestamp=2019-07-30T04:02:44.3716249Z caller=notes.go:497 msg="Excl
6969

7070
## Options
7171

72-
| Flag | Env Variable | Default Value | Required | Description |
73-
| ----------------------- | --------------- | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
72+
| Flag | Env Variable | Default Value | Required | Description |
73+
| ----------------------- | ----------------- | ------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7474
| **GITHUB REPO OPTIONS** |
75-
| | GITHUB_TOKEN | | Yes | A personal GitHub access token |
76-
| org | ORG | kubernetes | Yes | Name of GitHub organization |
77-
| repo | REPO | kubernetes | Yes | Name of GitHub repository |
78-
| required-author | REQUIRED_AUTHOR | k8s-ci-robot | Yes | Only commits from this GitHub user are considered. Set to empty string to include all users |
79-
| branch | BRANCH | master | Yes | The GitHub repository branch to scrape |
80-
| start-sha | START_SHA | | Yes | The commit hash to start processing from (inclusive) |
81-
| end-sha | END_SHA | | Yes | The commit hash to end processing at (inclusive) |
82-
| github-base-url | GITHUB_BASE_URL | | No | The base URL of Github |
83-
| github-upload-url | GITHUB_UPLOAD_URL | | No | The upload URL of enterprise Github |
84-
| repo-path | REPO_PATH | /tmp/k8s-repo | No | Path to a local Kubernetes repository, used only for tag discovery |
85-
| start-rev | START_REV | | No | The git revision to start at. Can be used as alternative to start-sha |
86-
| end-rev | END_REV | | No | The git revision to end at. Can be used as alternative to end-sha |
87-
| discover | DISCOVER | none | No | The revision discovery mode for automatic revision retrieval (options: none, mergebase-to-latest, patch-to-patch, patch-to-latest, minor-to-minor) |
88-
| release-bucket | RELEASE_BUCKET | kubernetes-release | No | Specify gs bucket to point to in generated notes (default "kubernetes-release") |
89-
| release-tars | RELEASE_TARS | | No | Directory of tars to sha512 sum for display |
75+
| | GITHUB_TOKEN | | Yes | A personal GitHub access token |
76+
| org | ORG | kubernetes | Yes | Name of GitHub organization |
77+
| repo | REPO | kubernetes | Yes | Name of GitHub repository |
78+
| required-author | REQUIRED_AUTHOR | k8s-ci-robot | Yes | Only commits from this GitHub user are considered. Set to empty string to include all users |
79+
| branch | BRANCH | master | Yes | The GitHub repository branch to scrape |
80+
| start-sha | START_SHA | | Yes | The commit hash to start processing from (inclusive) |
81+
| end-sha | END_SHA | | Yes | The commit hash to end processing at (inclusive) |
82+
| github-base-url | GITHUB_BASE_URL | | No | The base URL of Github |
83+
| github-upload-url | GITHUB_UPLOAD_URL | | No | The upload URL of enterprise Github |
84+
| repo-path | REPO_PATH | /tmp/k8s-repo | No | Path to a local Kubernetes repository, used only for tag discovery |
85+
| start-rev | START_REV | | No | The git revision to start at. Can be used as alternative to start-sha |
86+
| end-rev | END_REV | | No | The git revision to end at. Can be used as alternative to end-sha |
87+
| skip-first-commit | SKIP_FIRST_COMMIT | false | No | Skip the first commit if --start-rev is being used. This is useful if the --start-rev is a tag which should not be included in the release notes. |
88+
| discover | DISCOVER | none | No | The revision discovery mode for automatic revision retrieval (options: none, mergebase-to-latest, patch-to-patch, patch-to-latest, minor-to-minor) |
89+
| release-bucket | RELEASE_BUCKET | kubernetes-release | No | Specify gs bucket to point to in generated notes (default "kubernetes-release") |
90+
| release-tars | RELEASE_TARS | | No | Directory of tars to sha512 sum for display |
9091
| **OUTPUT OPTIONS** |
91-
| output | OUTPUT | | No | The path where the release notes will be written |
92-
| format | FORMAT | markdown | No | The format for notes output (options: json, markdown) |
93-
| markdown-links | MARKDOWN_LINKS | false | No | Add links for PRs and authors in the markdown format. This is useful when the release notes are outputted to a file. When using the GitHub release page to publish release notes, this option should be set to false to take advantage of Github's autolinked references (options: true, false) |
94-
| go-template | GO_TEMPLATE | go-template:default | No | The go template if `--format=markdown` (options: go-template:default, go-template:inline:<template-string> go-template:<file.template>) |
95-
| dependencies | | true | No | Add dependency report |
92+
| output | OUTPUT | | No | The path where the release notes will be written |
93+
| format | FORMAT | markdown | No | The format for notes output (options: json, markdown) |
94+
| markdown-links | MARKDOWN_LINKS | false | No | Add links for PRs and authors in the markdown format. This is useful when the release notes are outputted to a file. When using the GitHub release page to publish release notes, this option should be set to false to take advantage of Github's autolinked references (options: true, false) |
95+
| go-template | GO_TEMPLATE | go-template:default | No | The go template if `--format=markdown` (options: go-template:default, go-template:inline:<template-string> go-template:<file.template>) |
96+
| dependencies | | true | No | Add dependency report |
9697
| **LOG OPTIONS** |
97-
| debug | DEBUG | false | No | Enable debug logging (options: true, false) |
98+
| debug | DEBUG | false | No | Enable debug logging (options: true, false) |
9899

99100
## Building From Source
100101

cmd/release-notes/generate.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ func addGenerateFlags(subcommand *cobra.Command) {
113113
"The git revision to end at. Can be used as alternative to end-sha.",
114114
)
115115

116+
// SkipFirstCommit skips the first commit if StartRev is being used. This
117+
// is useful if StartRev is a tag which should not be included in the
118+
// release notes.
119+
subcommand.PersistentFlags().BoolVarP(
120+
&opts.SkipFirstCommit,
121+
"skip-first-commit",
122+
"s",
123+
env.IsSet("SKIP_FIRST_COMMIT"),
124+
"Skip the first commit if --start-rev is being used. This is useful if the --start-rev is a tag which should not be included in the release notes.",
125+
)
126+
116127
// repoPath contains the path to a local Kubernetes repository to avoid the
117128
// delay during git clone
118129
subcommand.PersistentFlags().StringVar(

go.mod

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/goark/go-cvss v1.6.6
1212
github.com/golang/protobuf v1.5.4
1313
github.com/google/go-containerregistry v0.19.1
14-
github.com/google/go-github/v58 v58.0.0
14+
github.com/google/go-github/v60 v60.0.0
1515
github.com/google/safetext v0.0.0-20230106111101-7156a760e523
1616
github.com/google/uuid v1.6.0
1717
github.com/hashicorp/go-multierror v1.1.1
@@ -34,24 +34,23 @@ require (
3434
github.com/tj/go-spin v1.1.0
3535
github.com/yuin/goldmark v1.7.1
3636
golang.org/x/net v0.25.0
37-
golang.org/x/oauth2 v0.19.0
37+
golang.org/x/oauth2 v0.21.0
3838
golang.org/x/text v0.15.0
3939
google.golang.org/api v0.172.0
4040
gopkg.in/yaml.v2 v2.4.0
41-
k8s.io/apimachinery v0.29.3
41+
k8s.io/apimachinery v0.29.4
4242
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
4343
sigs.k8s.io/bom v0.6.0
4444
sigs.k8s.io/mdtoc v1.3.0
4545
sigs.k8s.io/promo-tools/v3 v3.6.0
46-
sigs.k8s.io/release-sdk v0.11.0
46+
sigs.k8s.io/release-sdk v0.12.0
4747
sigs.k8s.io/release-utils v0.8.3-0.20240529125243-e30fa4b6f720
4848
sigs.k8s.io/yaml v1.4.0
4949
)
5050

5151
require (
5252
cloud.google.com/go v0.112.1 // indirect
53-
cloud.google.com/go/compute v1.25.0 // indirect
54-
cloud.google.com/go/compute/metadata v0.2.3 // indirect
53+
cloud.google.com/go/compute/metadata v0.3.0 // indirect
5554
cloud.google.com/go/iam v1.1.6 // indirect
5655
cuelabs.dev/go/oci/ociregistry v0.0.0-20240314152124-224736b49f2e // indirect
5756
cuelang.org/go v0.8.1 // indirect
@@ -235,7 +234,7 @@ require (
235234
github.com/sigstore/cosign/v2 v2.2.4 // indirect
236235
github.com/sigstore/fulcio v1.4.5 // indirect
237236
github.com/sigstore/rekor v1.3.6 // indirect
238-
github.com/sigstore/sigstore v1.8.3 // indirect
237+
github.com/sigstore/sigstore v1.8.4 // indirect
239238
github.com/sigstore/timestamp-authority v1.2.2 // indirect
240239
github.com/skeema/knownhosts v1.2.2 // indirect
241240
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect

0 commit comments

Comments
 (0)