# Copyright (C) Markus Franz Xaver Johannes Oberhumer
name: 'GitHub - Close pull requests'
on:
  #pull_request:
  workflow_dispatch:
jobs:
  job-close-pull-requests:
    if: github.repository_owner == 'upx'
    name: 'Close pull requests'
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - name: 'Close pull requests'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh pr list --repo='${{ github.repository }}' --state=open --json=number | jq '.[].number' | xargs -r -n1 -- gh pr close --repo='${{ github.repository }}'
