Skip to content

Lock Closed Issues

Lock Closed Issues #7

Workflow file for this run

name: Lock Closed Issues
on: workflow_dispatch
jobs:
lock-closed-issues:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Lock closed issues
run: |
issues=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/issues?state=closed" | jq -r '.[] | .number')
for issue in $issues; do
curl -s -X PUT -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"locked":true}' "https://api.github.com/repos/${{ github.repository }}/issues/$issue/lock"
done