Keep Streamlit App Active #7
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: Keep Streamlit App Active | |
on: | |
schedule: | |
- cron: '0 1 * * *' # Runs daily at 1 AM UTC | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
keep-active: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Update a dummy file to ensure changes are detected | |
- name: Update a dummy file | |
run: | | |
echo "Last run: $(date)" > last_run.log | |
# Step 3: Commit the changes | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add last_run.log | |
git commit -m "Keep Streamlit app active: $(date)" || echo "No changes to commit" | |
# Step 4: Push the changes | |
- name: Push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push || echo "No changes to push" | |
# Step 5: Send a GET request to the Streamlit app to keep it awake | |
- name: Keep app awake | |
run: | | |
curl -s https://bangalore-house-price.streamlit.app/ || echo "Streamlit app URL not reachable" |