DM Bot Poll #1371
This file contains hidden or 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: DM Bot Poll | |
| on: | |
| schedule: | |
| - cron: '*/2 * * * *' | |
| workflow_dispatch: | |
| jobs: | |
| poll: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: dm-bot-poll | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install deps | |
| run: pip install -r requirements.txt | |
| - name: Build .env from secrets | |
| run: | | |
| echo "IG_USER_ID=${{ secrets.IG_USER_ID }}" >> .env | |
| echo "IG_LONG_LIVED_TOKEN=${{ secrets.IG_LONG_LIVED_TOKEN }}" >> .env | |
| echo "IG_HANDLE=${{ secrets.IG_HANDLE || 'aashirathar' }}" >> .env | |
| - name: Poll comments | |
| run: python bot_comments.py | |
| - name: Poll DMs | |
| run: python bot_dms.py | |
| - name: Commit state | |
| run: | | |
| git config user.name "dm-bot" | |
| git config user.email "bot@noreply.github.com" | |
| git add state.json | |
| git diff --staged --quiet || git commit -m "state: $(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| git push |