From 90fa0b54968515649fcf79b2f823e3702aa34a38 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Mon, 27 Dec 2021 10:15:25 -0800 Subject: [PATCH] Automatically generate release notes --- .github/workflows/rust.yml | 5 +++-- Cargo.lock | 2 +- Cargo.toml | 2 +- src/post.rs | 2 +- src/utils.rs | 20 ++++---------------- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3878454..b0e849f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -43,12 +43,13 @@ jobs: if: github.base_ref != 'master' with: tag_name: ${{ steps.version.outputs.version }} - name: ${{ steps.version.outputs.version }} - NAME + name: ${{ steps.version.outputs.version }} - ${{ github.event.head_commit.message }} draft: true files: | target/release/libreddit libreddit.sha512 body: | - - ${{ github.event.head_commit.message }} ${{ github.sha }} + - ${{ github.event.head_commit.message }} ${{ github.sha }} + generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index 262e282..24a89f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -572,7 +572,7 @@ checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libreddit" -version = "0.20.3" +version = "0.20.4" dependencies = [ "askama", "async-recursion", diff --git a/Cargo.toml b/Cargo.toml index b8dcb26..b21ea92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "libreddit" description = " Alternative private front-end to Reddit" license = "AGPL-3.0" repository = "https://github.com/spikecodes/libreddit" -version = "0.20.3" +version = "0.20.4" authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"] edition = "2021" diff --git a/src/post.rs b/src/post.rs index c5e78c9..ff430fc 100644 --- a/src/post.rs +++ b/src/post.rs @@ -240,4 +240,4 @@ fn parse_comments(json: &serde_json::Value, post_link: &str, post_author: &str, } }) .collect() -} \ No newline at end of file +} diff --git a/src/utils.rs b/src/utils.rs index 5d6cfe8..96e617b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -96,31 +96,19 @@ impl Media { // If post is a video, return the video let (post_type, url_val, alt_url_val) = if data_preview["fallback_url"].is_string() { ( - if data_preview["is_gif"].as_bool().unwrap_or(false) { - "gif" - } else { - "video" - }, + if data_preview["is_gif"].as_bool().unwrap_or(false) { "gif" } else { "video" }, &data_preview["fallback_url"], Some(&data_preview["hls_url"]), ) } else if secure_media["fallback_url"].is_string() { ( - if secure_media["is_gif"].as_bool().unwrap_or(false) { - "gif" - } else { - "video" - }, + if secure_media["is_gif"].as_bool().unwrap_or(false) { "gif" } else { "video" }, &secure_media["fallback_url"], Some(&secure_media["hls_url"]), ) } else if crosspost_parent_media["fallback_url"].is_string() { ( - if crosspost_parent_media["is_gif"].as_bool().unwrap_or(false) { - "gif" - } else { - "video" - }, + if crosspost_parent_media["is_gif"].as_bool().unwrap_or(false) { "gif" } else { "video" }, &crosspost_parent_media["fallback_url"], Some(&crosspost_parent_media["hls_url"]), ) @@ -728,4 +716,4 @@ mod tests { assert_eq!(format_num(1001), ("1.0k".to_string(), "1001".to_string())); assert_eq!(format_num(1_999_999), ("2.0m".to_string(), "1999999".to_string())); } -} \ No newline at end of file +}