Auto Update Nyaa #4422
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: Auto Update Nyaa | |
on: | |
schedule: | |
- cron: '*/30 * * * *' | |
jobs: | |
update-rss: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install requests pytz | |
- name: Pull latest changes | |
run: | | |
git pull origin main --rebase | |
- name: Run update script | |
run: python nyaafeed.py | |
- name: Commit and push changes | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add rssfeed/*.xml | |
git commit -m "Update RSS feed" || echo "No changes to commit" | |
git pull origin main --rebase | |
git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}.git | |
- name: Trigger next workflow | |
run: | | |
curl -X POST -H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.GH_PAT }}" \ | |
https://api.github.com/repos/${{ github.repository }}/dispatches \ | |
-d '{"event_type":"trigger-airing"}' |