Skip to content

Manage Deploy PRs

Manage Deploy PRs #301

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