Skip to content

Commit

Permalink
Fix rules history script (#1339)
Browse files Browse the repository at this point in the history
* update-rule-history - fix url generation

* prod deploy - ensure sync history is run before deploying new version
  • Loading branch information
wicksipedia authored May 10, 2024
1 parent 1c0d300 commit 812e61e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:

syncHistory:
sync-history:
name: Sync Rules History
uses: ./.github/workflows/template-update-rules-history.yml
with:
Expand All @@ -28,7 +28,9 @@ jobs:
secrets: inherit

deploy:
needs: build
needs:
- build
- sync-history
name: Deploy
uses: ./.github/workflows/template-deploy.yml
with:
Expand Down
6 changes: 3 additions & 3 deletions build-scripts/update-rule-history.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cd SSW.Rules.Content/
git commit-graph write --reachable --changed-paths

#Step 1: GetHistorySyncCommitHash - Retrieve CommitHash from AzureFunction
$Uri = $AzFunctionBaseUrl + 'GetHistorySyncCommitHash'
$Uri = $AzFunctionBaseUrl + '/GetHistorySyncCommitHash'
$Headers = @{'x-functions-key' = $GetHistorySyncCommitHashKey}
$Response = Invoke-WebRequest -URI $Uri -Headers $Headers
$startCommitHash = $Response.Content -replace '"', ''
Expand Down Expand Up @@ -67,14 +67,14 @@ $historyArray | Foreach-Object {
$historyFileContents = ConvertTo-Json $historyFileArray

#Step 3: UpdateRuleHistory - Send History Patch to AzureFunction
$Uri = $AzFunctionBaseUrl + 'UpdateRuleHistory'
$Uri = $AzFunctionBaseUrl + '/UpdateRuleHistory'
$Headers = @{'x-functions-key' = $UpdateRuleHistoryKey}
$Response = Invoke-WebRequest -Uri $Uri -Method Post -Body $historyFileContents -Headers $Headers -ContentType 'application/json; charset=utf-8'

if(![string]::IsNullOrWhiteSpace($commitSyncHash))
{
#Step 4: UpdateHistorySyncCommitHash - Update Commit Hash with AzureFunction
$Uri = $AzFunctionBaseUrl + 'UpdateHistorySyncCommitHash'
$Uri = $AzFunctionBaseUrl + '/UpdateHistorySyncCommitHash'
$Headers = @{'x-functions-key' = $UpdateHistorySyncCommitHashKey}
$Body = @{
commitHash = $commitSyncHash
Expand Down

0 comments on commit 812e61e

Please sign in to comment.