diff --git a/.github/workflows/lock-prs.yml b/.github/workflows/lock-prs.yml new file mode 100644 index 0000000..0ccb6c9 --- /dev/null +++ b/.github/workflows/lock-prs.yml @@ -0,0 +1,24 @@ +name: "Lock closed PRs" + +on: + schedule: + - cron: "0 */8 * * *" + workflow_dispatch: + +jobs: + lock: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: sudo apt-get update && sudo apt install -y jq + + - name: Lock closed PRs + run: | + cmd=$(gh pr list --repo "$REPO" -L 100 --state closed --json number,updatedAt|jq '[.[] | select(.updatedAt >= (now - (7 * 24 * 60 * 60) | todate))] | sort_by(.updatedAt) | .[] | {number: .number, updatedAt: .updatedAt}'| jq '.number') + + for num in $cmd; do + gh pr lock --repo "$REPO" --reason "resolved" "$num" + done + env: + GITHUB_TOKEN: ${{ secrets.FLATHUBBOT_TOKEN }} + REPO: flathub/flathub