Daily Automation #382
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 Automation | |
on: | |
schedule: | |
- cron: '0 12 * * *' # Runs every day at midday (UTC) | |
workflow_dispatch: # Manual trigger | |
jobs: | |
automate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' # Use the desired Python version | |
- name: Install PyYAML | |
run: | | |
python -m pip install pyyaml | |
- name: Run Python Script | |
run: | | |
python ./utils/create_sdk_seed_json.py | |
- name: Validate Changes | |
run: | | |
# Validation script to check sdkSeedProviders.json | |
# Replace this with your validation logic | |
if python ./utils/validation_script.py; then | |
echo "Validation successful" | |
else | |
echo "Validation failed" | |
exit 1 # Exit with a non-zero code to stop the workflow if validation fails | |
fi | |
- name: Check Git Status | |
id: git_status | |
run: | | |
if [[ -n $(git status -s) ]]; then | |
echo "has_changes=true" >> $GITHUB_ENV | |
else | |
echo "has_changes=false" >> $GITHUB_ENV | |
fi | |
- name: Commit and Push Changes | |
if: env.has_changes == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add sdkSeedProviders.json | |
git commit -m "Automated changes" | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTOMATION_TOKEN }} |