Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Pick random adjective when generating release notes #995

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 1 addition & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ semver = "1.0"
# simplified filesystem access
glob = "0.3.1"
dirs = "5"
# Random number stuff
rand = "0.8.5"

# Interacting with GitHub
octocrab = "0.38.0"
Expand Down
45 changes: 44 additions & 1 deletion src-tauri/src/github/release_notes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rand::prelude::SliceRandom;
use serde::{Deserialize, Serialize};
use std::vec::Vec;
use ts_rs::TS;
Expand Down Expand Up @@ -168,9 +169,51 @@ pub async fn generate_release_note_announcement() -> Result<String, String> {
let modders_info = "Mod compatibility should not be impacted";
let server_hosters_info = "REPLACE ME";

let mut rng = rand::thread_rng();
let attributes = vec![
"adorable",
"amazing",
"beautiful",
"blithsome",
"brilliant",
"compassionate",
"dazzling",
"delightful",
"distinguished",
"elegant",
"enigmatic",
"enthusiastic",
"fashionable",
"fortuitous",
"friendly",
"generous",
"gleeful",
"gorgeous",
"handsome",
"lively",
"lovely",
"lucky",
"lustrous",
"marvelous",
"merry",
"mirthful",
"phantasmagorical",
"pretty",
"propitious",
"ravishing",
"sincere",
"sophisticated fellow",
"stupendous",
"vivacious",
"wonderful",
"zestful",
];

let selected_attribute = attributes.choose(&mut rng).unwrap();

// Build announcement string
let return_string = format!(
r"Hello beautiful people <3
r"Hello {selected_attribute} people <3
**Northstar `{current_ns_version}` is out!**

{general_info}
Expand Down
Loading