ci: Add action to lock closed PRs

This commit is contained in:
bbhtt
2024-11-02 01:23:35 +05:30
parent 1ebc3261ae
commit c95ce4b732
+24
View File
@@ -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