Skip to content

Commit 8fedbef

Browse files
chore: prefer gen.lock over releases.md (#243)
chore: prefer gen.lock over releases.md (#243) --------- Co-authored-by: Kanwardeep <[email protected]>
1 parent 96a7af7 commit 8fedbef

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

internal/actions/release.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,6 @@ func Release() error {
126126

127127
func GetDirAndShouldUseReleasesMD(files []string, dir string, usingReleasesMd bool) (string, bool) {
128128
for _, file := range files {
129-
// Maintain Support for RELEASES.MD for backward compatibility with existing publishing actions
130-
if strings.Contains(file, "RELEASES.md") {
131-
// file = ./RELEASES.md
132-
// dir = .
133-
dir = filepath.Dir(file)
134-
logging.Info("Found RELEASES.md in %s\n", dir)
135-
usingReleasesMd = true
136-
break
137-
}
138-
139129
if strings.Contains(file, "gen.lock") {
140130
// file = .speakeasy/gen.lock
141131
dir = filepath.Dir(file)
@@ -144,6 +134,16 @@ func GetDirAndShouldUseReleasesMD(files []string, dir string, usingReleasesMd bo
144134
}
145135

146136
logging.Info("Found gen.lock in %s\n", dir)
137+
break
138+
}
139+
// Maintain Support for RELEASES.MD for backward compatibility with existing publishing actions
140+
if strings.Contains(file, "RELEASES.md") {
141+
// file = ./RELEASES.md
142+
// dir = .
143+
dir = filepath.Dir(file)
144+
logging.Info("Found RELEASES.md in %s\n", dir)
145+
usingReleasesMd = true
146+
break
147147
}
148148
}
149149
return dir, usingReleasesMd

internal/actions/release_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ func TestGetDirAndShouldUseReleasesMD(t *testing.T) {
6565
want1: false,
6666
},
6767
{
68-
name: "RELEASES.md takes precedence over gen.lock",
68+
name: "gen.lock takes precedence over RELEASES.md",
6969
args: args{
7070
files: []string{".speakeasy/gen.lock", "RELEASES.md"},
7171
dir: ".",
7272
usingReleasesMd: false,
7373
},
7474
want: ".",
75-
want1: true,
75+
want1: false,
7676
},
7777
}
7878
for _, tt := range tests {

0 commit comments

Comments
 (0)