From 1340bcfa75af81af96c132db93b0e51509764327 Mon Sep 17 00:00:00 2001 From: selmankoc Date: Fri, 16 Jun 2023 11:47:56 +0300 Subject: [PATCH] Create trigger-release.ps1 --- .github/scripts/trigger-release.ps1 | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/scripts/trigger-release.ps1 diff --git a/.github/scripts/trigger-release.ps1 b/.github/scripts/trigger-release.ps1 new file mode 100644 index 0000000000..9aae8f3ea9 --- /dev/null +++ b/.github/scripts/trigger-release.ps1 @@ -0,0 +1,30 @@ +param( + [string]$tag_name, + [string]$prerelease, + [string]$branchName +) + +# GitHub credentials and repository info +$user = "skoc10" +$repo = "my_projects" +$workflow_file_name = "publish-release.yml" +$token = $env:RELEASE_TOKEN + +# Create a header for the API request +$headers = @{ + Authorization = "Bearer $token" + Accept = "application/vnd.github.v3+json" +} + +# Create a body for the API request +$body = @{ + ref = $branchName + inputs = @{ + tag_name = $tag_name + prerelease = $prerelease + branchName = $branchName + } +} | ConvertTo-Json + +# Send the API request to GitHub +Invoke-RestMethod -Method Post -Headers $headers -Body $body -Uri "https://api.github.com/repos/$user/$repo/actions/workflows/$workflow_file_name/dispatches"