Skip to content

Commit a6712f4

Browse files
author
tejasgn
committed
adding sync logic for steering and specifications
1 parent 97384eb commit a6712f4

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: syncSteerSpecs
2+
on:
3+
push:
4+
branches: ["main"]
5+
workflow_dispatch:
6+
inputs:
7+
dir_name:
8+
description: 'Sync Directories'
9+
required: true
10+
default: 'steering_docs'
11+
type: choice
12+
options:
13+
- steering_docs
14+
- scenarios
15+
16+
17+
permissions:
18+
id-token: write
19+
20+
jobs:
21+
run_job_with_aws:
22+
runs-on: ubuntu-latest
23+
env:
24+
sdk_name: ${{ github.event.inputs.sdk_name || 'steering_docs' }}
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Configure AWS Credentials
31+
uses: aws-actions/configure-aws-credentials@v5
32+
with:
33+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
34+
aws-region: us-west-2
35+
36+
- name: Set SDK and language mapping for S3
37+
run: |
38+
if [ "$dir_name" == "steering_docs" ]; then
39+
echo "S3_NAME=steering-docs" >> $GITHUB_ENV
40+
elif [ "$dir_name" == "scenarios" ]; then
41+
echo "S3_NAME=final-specs" >> $GITHUB_ENV
42+
fi
43+
44+
- name: Filter SPECIFICATION.md files for scenarios
45+
if: ${{ github.event.inputs.dir_name == 'scenarios' }}
46+
run: |
47+
find ./scenarios -name "SPECIFICATION.md" -exec cp --parents {} ./filtered_scenarios/ \;
48+
49+
- name: Upload/Sync to S3
50+
run: |
51+
if [ "$dir_name" == "scenarios" ]; then
52+
aws s3 sync "./filtered_scenarios/scenarios/" "s3://$S3_NAME-bucket/" --delete
53+
else
54+
aws s3 sync "./$dir_name/" "s3://$S3_NAME-bucket/" --delete
55+
fi
56+
57+
- name: Sync Knowledge Base Data Source
58+
run: |
59+
aws lambda invoke \
60+
--function-name KB_Updater \
61+
--payload "{\"language\":\"$S3_NAME\",\"region\":\"us-west-2\"}" \
62+
--cli-binary-format raw-in-base64-out \
63+
response.json
64+
65+
echo "Knowledge Base sync initiated"
66+
cat response.json

0 commit comments

Comments
 (0)