Created
February 26, 2024 06:26
-
-
Save thufschmitt/6ce73ec2ac7f38be3ee748ab16ba3aa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
gh_ () { | |
## Dry-run mode | |
echo "gh $@" | |
## Real mode | |
# gh "$@" | |
} | |
####################################### | |
issues_to_close=( | |
https://github.com/NixOS/20th-nix/issues/2 | |
https://github.com/NixOS/hydra-ant-logger/issues/1 | |
https://github.com/NixOS/hydra-provisioner/issues/4 | |
https://github.com/NixOS/mvn2nix-maven-plugin/issues/33 | |
https://github.com/NixOS/nix-book/issues/31 | |
https://github.com/NixOS/nix-eclipse/issues/2 | |
https://github.com/NixOS/nixos-planet/issues/8 | |
https://github.com/NixOS/nixos-weekly/issues/172 | |
https://github.com/NixOS/nixpart/issues/13 | |
https://github.com/NixOS/npm2nix/issues/53 | |
https://github.com/NixOS/package-list/issues/1 | |
https://github.com/NixOS/snapd-nix-base/issues/1 | |
) | |
issues_to_close_with_default_branch_to_moved=( | |
https://github.com/NixOS/distribution-nixpkgs/issues/26 | |
https://github.com/NixOS/hackage-db/issues/18 | |
https://github.com/NixOS/language-nix/issues/8 | |
) | |
archive_repo() { | |
local repo=$1 | |
gh_ repo archive "$repo" | |
} | |
comment_on_issue() { | |
local issue_url=$1 | |
gh_ issue comment "$issue_url" --body "Archiving the repo as indicated. Please comment on https://github.com/NixOS/teams-collaboration/issues/1 if this is a mistake." | |
gh_ issue close "$issue_url" | |
} | |
get_repo_for_issue() { | |
local issue_url=$1 | |
echo "$issue" | sed 's/\(https:\/\/github.com\/[^/]*\/[^/]*\).*/\1/' | |
} | |
for issue in "${issues_to_close[@]}"; do | |
repo=$(get_repo_for_issue "$issue") | |
comment_on_issue "$issue" | |
archive_repo "$repo" | |
done | |
for issue in "${issues_to_close_with_default_branch_to_moved[@]}"; do | |
repo=$(get_repo_for_issue "$issue") | |
comment_on_issue "$issue" | |
gh_ repo edit --default-branch=moved "$repo" | |
archive_repo "$repo" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment