Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
1 change: 0 additions & 1 deletion .github/workflows/release-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ jobs:
release-changelog:
name: Release API Changelog
needs: release
if: ${{ needs.release.outputs.changes_detected == 'true' }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix

Copy link
Collaborator

@fmenezes fmenezes Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is needs.release.outputs.changes_detected supposed to mean then?

uses: ./.github/workflows/release-changelog.yml
secrets:
api_bot_pat: ${{ secrets.api_bot_pat }}
Expand Down
61 changes: 61 additions & 0 deletions tools/cli/internal/changelog/changelog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,3 +861,64 @@
})
}
}

func TestLatestVersionActiveOnDate(t *testing.T) {
tests := []struct {
name string
date string
versions []string
expectedOutput string
expectedError assert.ErrorAssertionFunc
}{
{
name: "Valid case with multiple versions",
date: "2024-11-13",
versions: []string{"2023-01-01",
"2023-02-01",
"2023-10-01",
"2023-11-15",
"2024-05-30",
"2024-08-05",
"2024-10-23",
"2024-11-13"},
expectedOutput: "2024-11-13",
expectedError: assert.NoError,
},
//{
// name: "Date before all versions",
// date: "2022-12-11",
// versions: []string{"2023-01-01", "2023-06-01", "2023-11-01"},
// expectedOutput: "",
// expectedError: assert.NoError,
//},

Check failure on line 893 in tools/cli/internal/changelog/changelog_test.go

View workflow job for this annotation

GitHub Actions / lint

commentFormatting: put a space between `//` and comment text (gocritic)
//{
// name: "Empty versions list",
// date: "2023-12-11",
// versions: []string{},
// expectedOutput: "",
// expectedError: assert.NoError,
//},
//{
// name: "Invalid date format",
// date: "invalid-date",
// versions: []string{"2023-01-01"},
// expectedOutput: "",
// expectedError: assert.Error,
//},
//{
// name: "Invalid version format in list",
// date: "2023-12-11",
// versions: []string{"invalid-version", "2023-06-01"},
// expectedOutput: "",
// expectedError: assert.Error,
//},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
output, err := latestVersionActiveOnDate(tt.date, tt.versions)
tt.expectedError(t, err)
assert.Equal(t, output, tt.expectedOutput)

Check failure on line 921 in tools/cli/internal/changelog/changelog_test.go

View workflow job for this annotation

GitHub Actions / lint

expected-actual: need to reverse actual and expected values (testifylint)
})
}
}
Loading