Manage Deploy PRs #301
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: Manage Deploy PRs | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| jobs: | |
| build: | |
| if: ${{ github.actor == 'ajbarga' || github.event_name == 'schedule' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pygithub | |
| - name: Manage Deploy PRs | |
| run: | | |
| from github import Github as GH | |
| g = GH('${{ secrets.MY_PAT }}') | |
| r = g.get_repo('ajbarga/word-game') | |
| for pr in r.get_pulls(): | |
| if pr.base.ref == 'gh-pages' and 'Dploy PR' in pr.title: | |
| pr.edit(state='closed') | |
| r.get_git_ref(f'heads/{pr.head.ref}').delete() | |
| shell: python |