From 6cbcbe0aedbe95d0197cfdf6b701e443c5933529 Mon Sep 17 00:00:00 2001 From: bryan cook <3217452+bryanbcook@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:40:30 -0400 Subject: [PATCH 1/5] Change Google client id and secret to PSBloggerAPI --- src/public/Add-GoogleDriveFile.ps1 | 2 +- src/public/Initialize-Blogger.ps1 | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/public/Add-GoogleDriveFile.ps1 b/src/public/Add-GoogleDriveFile.ps1 index 66730ca..3b9cda4 100644 --- a/src/public/Add-GoogleDriveFile.ps1 +++ b/src/public/Add-GoogleDriveFile.ps1 @@ -30,7 +30,7 @@ function Add-GoogleDriveFile { [string]$FileName, [Parameter()] - [string]$TargetFolderName = "Open Live Writer", + [string]$TargetFolderName = "PSBlogger", [Parameter()] [switch]$Force diff --git a/src/public/Initialize-Blogger.ps1 b/src/public/Initialize-Blogger.ps1 index ad41697..0983315 100644 --- a/src/public/Initialize-Blogger.ps1 +++ b/src/public/Initialize-Blogger.ps1 @@ -25,10 +25,10 @@ Initiate a login flow with Google Function Initialize-Blogger { Param( [Parameter(HelpMessage = "Google API ClientId")] - [string]$clientId = "284606892422-ribvo7oodlbtd70e8onn8rg4hm58mluj.apps.googleusercontent.com", + [string]$clientId = "<>", [Parameter(HelpMessage = "Google API Client Secret")] - [string]$clientSecret = "PUK0j9ig-GHcSByQao2i1aIa", + [string]$clientSecret = "<>", [Parameter(HelpMessage = "Redirect Uri specified in Google API Consent Form")] [string]$redirectUri = "http://localhost/oauth2callback" @@ -41,8 +41,7 @@ Function Initialize-Blogger { # specify the scopes we want in our auth token $scope = @( "https://www.googleapis.com/auth/blogger" - #"https://www.googleapis.com/auth/drive.file" # TODO: fix - "https://www.googleapis.com/auth/drive" + "https://www.googleapis.com/auth/drive.file" ) -join " " From 5387030d6246da0089ef6e0ba11005209612e0aa Mon Sep 17 00:00:00 2001 From: bryan cook <3217452+bryanbcook@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:40:55 -0400 Subject: [PATCH 2/5] Don't include trashed files in Google Drive queries --- src/public/Get-GoogleDriveItems.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/public/Get-GoogleDriveItems.ps1 b/src/public/Get-GoogleDriveItems.ps1 index 9ee5e20..053e592 100644 --- a/src/public/Get-GoogleDriveItems.ps1 +++ b/src/public/Get-GoogleDriveItems.ps1 @@ -53,10 +53,12 @@ function Get-GoogleDriveItems { $q += "'$ParentId' in parents" } + $q += "trashed=false" # Exclude trashed items + $queryArgs = @{ q = [System.Web.HttpUtility]::UrlEncode($q -join ' and ') pageSize = 40 - } + } do { From 859384ba0747947f24df0baf05be214cdac73361 Mon Sep 17 00:00:00 2001 From: bryan cook <3217452+bryanbcook@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:10:45 -0400 Subject: [PATCH 3/5] rev version to 0.3.0 --- src/PSBlogger.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PSBlogger.psd1 b/src/PSBlogger.psd1 index 33514f7..6c3b8e9 100644 --- a/src/PSBlogger.psd1 +++ b/src/PSBlogger.psd1 @@ -5,7 +5,7 @@ RootModule = 'PSBlogger.psm1' # Version number of this module. -ModuleVersion = '0.2.0' +ModuleVersion = '0.3.0' # Supported PSEditions # CompatiblePSEditions = @() From 89605a0b4c6a0009531dc0ef3ed90cd72c114e15 Mon Sep 17 00:00:00 2001 From: bryan cook <3217452+bryanbcook@users.noreply.github.com> Date: Mon, 28 Jul 2025 16:41:31 -0400 Subject: [PATCH 4/5] update meta in powershell module --- src/PSBlogger.psd1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PSBlogger.psd1 b/src/PSBlogger.psd1 index 6c3b8e9..9353ac6 100644 --- a/src/PSBlogger.psd1 +++ b/src/PSBlogger.psd1 @@ -20,7 +20,7 @@ Author = 'Bryan Cook' CompanyName = 'Bryan Cook' # Copyright statement for this module -Copyright = '#169; me' +# Copyright = '#169; me' # Description of the functionality provided by this module Description = 'Module to publish markdown files to Blogger' @@ -97,16 +97,16 @@ PrivateData = @{ Tags = 'blogger','markdown','pandoc' # A URL to the license for this module. - #LicenseUri = '' + LicenseUri = 'https://github.com/bryanbcook/PSBlogger?tab=MIT-1-ov-file#readme' # A URL to the main website for this project. - ProjectUri = 'http://www.bryancook.net/' + ProjectUri = 'https://github.com/bryanbcook/PSBlogger' # A URL to an icon representing this module. #IconUri = '' # ReleaseNotes of this module - #ReleaseNotes = '' + ReleaseNotes = 'https://github.com/bryanbcook/PSBlogger/releases' # Prerelease string of this module # Prerelease = '' From edfc24593beb01ebf904656f678dbd1cc741b229 Mon Sep 17 00:00:00 2001 From: bryan cook <3217452+bryanbcook@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:15:34 -0400 Subject: [PATCH 5/5] modify publish workflow to use secrets --- .github/workflows/publish.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1058632..d011e86 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -186,6 +186,18 @@ jobs: if ($testResults.FailedCount -gt 0) { throw "Tests failed. Cannot publish to PowerShell Gallery." } + + - name: Inject Values into Module + shell: pwsh + env: + CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} + run: | + $file = "./src/public/Initialize-Blogger.ps1" + $content = Get-Content $file -Raw + $content = $content -replace "<>", $env:CLIENT_ID + $content = $content -replace "<>", $env:CLIENT_SECRET + $content | Set-Content -Path $file -Force - name: Publish to PowerShell Gallery shell: pwsh