Skip to content

Commit 192d2c4

Browse files
authored
chore(librarian): rename source_commit_hash to commit_hash (googleapis#13165)
See googleapis/librarian#2224 Fixes googleapis/librarian#2596
1 parent f511368 commit 192d2c4

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

internal/librariangen/release/release.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ func updateChangelog(cfg *Config, lib *request.Library, t time.Time) error {
152152
for _, subj := range subjects {
153153
change := subjectsMap[subj]
154154
var commitLink string
155-
if change.SourceCommitHash != "" {
156-
shortHash := change.SourceCommitHash
155+
if change.CommitHash != "" {
156+
shortHash := change.CommitHash
157157
if len(shortHash) > 7 {
158158
shortHash = shortHash[:7]
159159
}
160-
commitURL := fmt.Sprintf("https://github.com/googleapis/google-cloud-go/commit/%s", change.SourceCommitHash)
160+
commitURL := fmt.Sprintf("https://github.com/googleapis/google-cloud-go/commit/%s", change.CommitHash)
161161
commitLink = fmt.Sprintf("([%s](%s))", shortHash, commitURL)
162162
}
163163

internal/librariangen/release/release_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ func TestInit(t *testing.T) {
128128
"source_roots": ["secretmanager"],
129129
"apis": [{"path": "google/cloud/secretmanager/v1"}],
130130
"changes": [
131-
{"type": "feat", "subject": "another feature", "source_commit_hash": "zxcvbn098765"},
132-
{"type": "fix", "subject": "correct typo in documentation", "source_commit_hash": "123456abcdef"},
133-
{"type": "feat", "subject": "add new GetSecret API", "source_commit_hash": "abcdef123456"}
131+
{"type": "feat", "subject": "another feature", "commit_hash": "zxcvbn098765"},
132+
{"type": "fix", "subject": "correct typo in documentation", "commit_hash": "123456abcdef"},
133+
{"type": "feat", "subject": "add new GetSecret API", "commit_hash": "abcdef123456"}
134134
],
135135
"tag_format": "{id}/v{version}"
136136
}]
@@ -169,9 +169,9 @@ func TestInit(t *testing.T) {
169169
"id": "wholerepo", "version": "1.16.0", "release_triggered": true,
170170
"source_roots": ["."],
171171
"changes": [
172-
{"type": "feat", "subject": "another feature", "source_commit_hash": "zxcvbn098765"},
173-
{"type": "fix", "subject": "correct typo in documentation", "source_commit_hash": "123456abcdef"},
174-
{"type": "feat", "subject": "add new GetSecret API", "source_commit_hash": "abcdef123456"}
172+
{"type": "feat", "subject": "another feature", "commit_hash": "zxcvbn098765"},
173+
{"type": "fix", "subject": "correct typo in documentation", "commit_hash": "123456abcdef"},
174+
{"type": "feat", "subject": "add new GetSecret API", "commit_hash": "abcdef123456"}
175175
],
176176
"tag_format": "v{version}"
177177
}]
@@ -191,9 +191,9 @@ func TestInit(t *testing.T) {
191191
"id": "root-module", "version": "1.16.0", "release_triggered": true,
192192
"source_roots": ["civil", "rpcreplay", "httpreplay"],
193193
"changes": [
194-
{"type": "feat", "subject": "another feature", "source_commit_hash": "zxcvbn098765"},
195-
{"type": "fix", "subject": "correct typo in documentation", "source_commit_hash": "123456abcdef"},
196-
{"type": "feat", "subject": "add new GetSecret API", "source_commit_hash": "abcdef123456"}
194+
{"type": "feat", "subject": "another feature", "commit_hash": "zxcvbn098765"},
195+
{"type": "fix", "subject": "correct typo in documentation", "commit_hash": "123456abcdef"},
196+
{"type": "feat", "subject": "add new GetSecret API", "commit_hash": "abcdef123456"}
197197
],
198198
"tag_format": "v{version}"
199199
}]
@@ -213,7 +213,7 @@ func TestInit(t *testing.T) {
213213
"id": "xyz", "version": "1.16.0", "release_triggered": true,
214214
"source_roots": ["xyz"],
215215
"changes": [
216-
{"type": "feat", "subject": "another feature", "source_commit_hash": "zxcvbn098765"}
216+
{"type": "feat", "subject": "another feature", "commit_hash": "zxcvbn098765"}
217217
],
218218
"tag_format": "custom-{id}-v{version}"
219219
}]

internal/librariangen/request/request.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ type API struct {
5353

5454
// Change represents a single commit change for a library.
5555
type Change struct {
56-
Type string `json:"type"`
57-
Subject string `json:"subject"`
58-
Body string `json:"body"`
59-
PiperCLNumber string `json:"piper_cl_number"`
60-
SourceCommitHash string `json:"source_commit_hash"`
56+
Type string `json:"type"`
57+
Subject string `json:"subject"`
58+
Body string `json:"body"`
59+
PiperCLNumber string `json:"piper_cl_number"`
60+
CommitHash string `json:"commit_hash"`
6161
}
6262

6363
// ParseLibrary reads a file from the given path and unmarshals

internal/librariangen/testdata/release-init/librarian/release-init-request.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
"subject": "add new GetSecret API",
1010
"body": "This adds the ability to retrieve a secret's metadata.",
1111
"piper_cl_number": "123456789",
12-
"source_commit_hash": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"
12+
"commit_hash": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"
1313
},
1414
{
1515
"type": "fix",
1616
"subject": "correct typo in documentation",
1717
"body": "Fixed a minor typo in the client library documentation.",
1818
"piper_cl_number": "987654321",
19-
"source_commit_hash": "f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3b2a1f6e5"
19+
"commit_hash": "f6e5d4c3b2a1f6e5d4c3b2a1f6e5d4c3b2a1f6e5"
2020
}
2121
],
2222
"apis": [

internal/stategen/state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type Change struct {
100100
// The Changelist number in piper associated with this change.
101101
ClNum string `yaml:"piper_cl_number" json:"piper_cl_number"`
102102
// The commit hash in the source repository associated with this change.
103-
CommitHash string `yaml:"source_commit_hash" json:"source_commit_hash"`
103+
CommitHash string `yaml:"commit_hash" json:"commit_hash"`
104104
}
105105

106106
// GitHubBranch is the representation of a repository branch as returned by the GitHub

0 commit comments

Comments
 (0)