-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (53 loc) · 1.84 KB
/
daily_update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Daily Parameter Update
on:
schedule:
- cron: '0 0 * * *' # Schedule the workflow to run daily at midnight UTC
workflow_dispatch:
jobs:
update_and_commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install Python Packages
run: |
pip install -r requirements.txt
- name: Run Python script
run: |
python update_parameters.py
env:
DB_IDENTIFIER: "terraform-blog-example"
OT_API_KEY: ${{ secrets.OT_API_KEY }}
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.6.5 # Replace with your desired Terraform version
- name: Initialize Terraform
run: terraform init
- name: Apply Terraform changes
# CAUTION: -auto-approve may override changes to the infra
# that are not saved in the terraform files
run: terraform apply -auto-approve
env:
TF_VAR_db_password: ${{ secrets.DB_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Check if there are any changes
id: verify_diff
run: |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit changes
if: steps.verify_diff.outputs.changed == 'true'
run: |
git status
git config user.email "[email protected]"
git config user.name "priyank96"
git add db_params.tf
git commit -m "AI knob updates"
git push
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} # GitHub access token