fix github actions error #88
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: run python script | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # runs at 00:00 UTC every Sunday | |
push: | |
branches: | |
- dev | |
pull_request: | |
branches: | |
- main | |
jobs: | |
manual_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo content | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 # Update to latest version | |
with: | |
python-version: 3.10.10 | |
- name: Install Python dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Create necessary directories | |
run: | | |
mkdir -p data logs | |
- name: Execute Python script | |
run: | | |
python run.py | |
- name: Pull latest changes | |
run: | | |
git pull origin main | |
- name: Commit files | |
id: commit | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "github-actions" | |
git add --all | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "push=false" >> $GITHUB_ENV # Use Environment Files for setting output | |
else | |
git commit -m "Add changes" -a | |
echo "push=true" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Push changes | |
if: env.push == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |