Skip to content

Instantly share code, notes, and snippets.

@snickell
Last active February 4, 2024 02:08
Show Gist options
  • Save snickell/80bea3908125d982704e36f51cd7dac3 to your computer and use it in GitHub Desktop.
Save snickell/80bea3908125d982704e36f51cd7dac3 to your computer and use it in GitHub Desktop.
#!/bin/bash
gh pr list -L 57000 -s closed --json number,closedAt,mergedAt,updatedAt,url -q '.[] | select(.mergedAt == null and .updatedAt >= "2024-02-03T05:00:00Z" and .updatedAt <= "2024-02-03T06:00:00Z")' > misclosed.txt
# Add array braces and commas to make misclosed.txt a valid JSON list...
echo "[" > misclosed.json
awk 'NR > 1 { print line "," } { line = $0 } END { print line }' misclosed.txt >> misclosed.json
echo "]" >> misclosed.json
jq '.[].number' misclosed.json | while read number; do
echo "Reopening PR number: $number"
gh pr reopen "$number" --comment "This PR was accidentally auto-closed during the Git LFS migration (https://github.com/code-dot-org/code-dot-org/issues/55759), reopening it, sorry 'bout that 😘, -Seth"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment