Weekly Bot #396
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: Weekly Bot | |
on: | |
schedule: | |
- cron: '30 21 * * *' | |
jobs: | |
Weekly-Bot-Actions: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run script | |
env: | |
LOGLEVEL: 'DEBUG' | |
run: python main.py | |
- name: Check for changes | |
run: | | |
if git diff --exit-code; then | |
echo "changed=false" >> "$GITHUB_ENV" | |
else | |
echo "changed=true" >> "$GITHUB_ENV" | |
fi | |
- name: Commit files | |
if: ${{ env.changed == 'true' }} | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Bot: update $(date +%Y%m%d)" | |
- name: Push changes | |
if: ${{ env.changed == 'true' }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |