Skip to content

Commit 36f8f37

Browse files
populate config table
1 parent 42fb118 commit 36f8f37

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/scripts/dispatch_internal_repo_workflow.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ while [[ $# -gt 0 ]]; do
104104
version="$2"
105105
shift 2
106106
;;
107+
--tableName) # Table name (optional)
108+
tableName="$2"
109+
shift 2
110+
;;
107111
*)
108112
echo "[ERROR] Unknown argument: $1"
109113
exit 1
@@ -202,6 +206,10 @@ if [[ -z "$version" ]]; then
202206
version=""
203207
fi
204208

209+
if [{ -z "$tableName" }]; then
210+
tableName=""
211+
fi
212+
205213
echo "==================== Workflow Dispatch Parameters ===================="
206214
echo " infraRepoName: $infraRepoName"
207215
echo " releaseVersion: $releaseVersion"
@@ -221,6 +229,7 @@ echo " apimEnvironment: $apimEnvironment"
221229
echo " boundedContext: $boundedContext"
222230
echo " targetDomain: $targetDomain"
223231
echo " version: $version"
232+
echo " tableName: $tableName"
224233

225234
DISPATCH_EVENT=$(jq -ncM \
226235
--arg infraRepoName "$infraRepoName" \
@@ -240,6 +249,7 @@ DISPATCH_EVENT=$(jq -ncM \
240249
--arg boundedContext "$boundedContext" \
241250
--arg targetDomain "$targetDomain" \
242251
--arg version "$version" \
252+
--arg tableName "$tableName" \
243253
'{
244254
"ref": "'"$internalRef"'",
245255
"inputs": (
@@ -255,6 +265,7 @@ DISPATCH_EVENT=$(jq -ncM \
255265
(if $boundedContext != "" then { "boundedContext": $boundedContext } else {} end) +
256266
(if $targetDomain != "" then { "targetDomain": $targetDomain } else {} end) +
257267
(if $version != "" then { "version": $version } else {} end) +
268+
(if $tableName != "" then { "tableName": $tableName } else {} end) +
258269
(if $targetAccountGroup != "" then { "targetAccountGroup": $targetAccountGroup } else {} end) +
259270
{
260271
"releaseVersion": $releaseVersion,

.github/workflows/stage-3-build.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,33 @@ jobs:
184184
runId: "${{ github.run_id }}"
185185
buildSandbox: true
186186
releaseVersion: ${{ github.head_ref || github.ref_name }}
187+
populate-config:
188+
name: "Populate Supplier Config"
189+
runs-on: ubuntu-latest
190+
needs: [pr-create-dynamic-environment]
191+
timeout-minutes: 10
192+
193+
steps:
194+
- name: "Checkout code"
195+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
196+
- name: Set Environment Name
197+
id: set-environment
198+
run: echo "environment_name=${{ inputs.pr_number != '' && format('pr{0}', inputs.pr_number) || 'main' }}" >> $GITHUB_OUTPUT
199+
- name: "Trigger populate config workflow in internal repo"
200+
env:
201+
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
202+
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
203+
PR_NUMBER: ${{ inputs.pr_number }}
204+
shell: bash
205+
run: |
206+
.github/scripts/dispatch_internal_repo_workflow.sh \
207+
--infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \
208+
--releaseVersion ${{ github.head_ref || github.ref_name }} \
209+
--targetWorkflow "publish-supplier-config.yaml" \
210+
--targetEnvironment "${{ steps.set-environment.outputs.environment_name }}" \
211+
--targetComponent "api" \
212+
--targetAccountGroup "nhs-notify-suppliers-dev" \
213+
--overrideProjectName "nhs" \
214+
--overrideRoleName "nhs-main-acct-supplier-api-github-deploy" \
215+
--tableName "supplier-config" \
216+
--internalRef "feature/CCM-12444-supplier-config-publishing-workflow"

0 commit comments

Comments
 (0)