Skip to content

Commit

Permalink
Merge pull request #245 from im-practices/pwsh-outputs
Browse files Browse the repository at this point in the history
ARCH-2007 - Update the way outputs are set in pwsh
  • Loading branch information
danielle-casella-adams authored Feb 2, 2024
2 parents dadd8c1 + 872158b commit 84731ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
16 changes: 9 additions & 7 deletions workflow-templates/im-build-db-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow Code: GiddyBuzzard_v17 DO NOT REMOVE
# Workflow Code: GiddyBuzzard_v18 DO NOT REMOVE
# Purpose:
# The main purpose of this workflow is to verify that the database can be created, all of the migration scripts can be run, and any tests that exist pass.
# In addition to that, however, there are three other things this workflow template is set up to do.
Expand Down Expand Up @@ -70,18 +70,19 @@ jobs:
$CurrentBranchIsDefault = ($CurrentBranch -eq "${{ env.DEFAULT_BRANCH }}")
$LastCommitIsSnapshot = ($LastCommitBy -eq "github-actions")
echo "isDefaultBranch=$CurrentBranchIsDefault" >> $GITHUB_OUTPUT
echo "isSnapshot=$LastCommitIsSnapshot" >> $GITHUB_OUTPUT
"isDefaultBranch=$CurrentBranchIsDefault" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"isSnapshot=$LastCommitIsSnapshot" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
if ($LastCommitIsSnapshot -and !$CurrentBranchIsDefault)
{
Write-Host "Snapshot was last commit, skipping the other jobs"
echo "skip=true" >> $GITHUB_OUTPUT
"skip=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
}
else
{
Write-Host "Snapshot was not the last commit, continuing with the other jobs"
echo "skip=false" >> $GITHUB_OUTPUT
"skip=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
}
# TODO: Remove this linting job if your project doesn't need/want it
Expand All @@ -98,7 +99,8 @@ jobs:

- id: migration-folder
shell: pwsh
run: echo "folder=$($(Get-Date).Year).$($(Get-Date).Month.ToString("00"))" >> $GITHUB_OUTPUT
run: |
"folder=$($(Get-Date).Year).$($(Get-Date).Month.ToString("00"))" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: SQL Lint
uses: im-open/[email protected]
with:
Expand Down Expand Up @@ -195,7 +197,7 @@ jobs:
# $mappedObjects = $changedObjects | foreach-object { @{ schemaName=$_.schemaName; objectName=$_.objectName; objectType=$_.objectType; operationType=$_.operationType } }
# $objectsAsJson = $mappedObjects | ConvertTo-Json -Compress

# echo "json=$objectsAsJson" >> $GITHUB_OUTPUT
# "json=$objectsAsJson" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

# - name: Increment snapshots
# uses: im-open/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions workflow-templates/im-deploy-tf-manual-apply.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow Code: InsaneHamster_v45 DO NOT REMOVE
# Workflow Code: InsaneHamster_v46 DO NOT REMOVE
# Purpose:
# Deploys the terraform from a specified root module at a
# specified when someone kicks off the workflow manually.
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
az storage blob upload --no-progress --auth-mode login --account-name ${{ needs.set-vars.outputs.STORAGE_ACCOUNT }} --container-name ${{ env.PLAN_STORAGE_CONTAINER }} --file $terraformPlanName --name $terraformBlobName
echo "The plan was successfully uploaded"
echo "tf_plan_name=$terraformPlanName" >> $env:GITHUB_OUTPUT
"tf_plan_name=$terraformPlanName" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Azure logout
run: |
Expand Down
4 changes: 2 additions & 2 deletions workflow-templates/im-run-tf-destroy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow Code: HostileMacaw_v23 DO NOT REMOVE
# Workflow Code: HostileMacaw_v24 DO NOT REMOVE
# Purpose:
# Destroys the resources created by a terraform configuration when someone kicks it off manually.
#
Expand Down Expand Up @@ -246,7 +246,7 @@ jobs:
az storage blob upload --no-progress --auth-mode login --account-name ${{ needs.set-vars.outputs.STORAGE_ACCOUNT }} --container-name ${{ env.PLAN_STORAGE_CONTAINER }} --file $terraformPlanName --name $terraformBlobName
echo "The plan was successfully uploaded"
echo "tf_plan_name=$terraformPlanName" >> $env:GITHUB_OUTPUT
"tf_plan_name=$terraformPlanName" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Azure logout
run: |
Expand Down

0 comments on commit 84731ef

Please sign in to comment.