Daily Parameter Update #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Commit changes | |
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 | |