1
Fork 0

Rename github account

This commit is contained in:
prescientmoon 2024-05-28 02:39:42 +02:00
parent a28c4932f7
commit 2d9ade9c00
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
11 changed files with 80 additions and 9 deletions

View file

@ -45,7 +45,7 @@ Here's some things you might want to check out:
- My [neovim config](./home/features/neovim/default.nix)
- written using a [custom neovim config generation framework](./modules/common/korora-neovim.nix)
- [snippets](./home/features/neovim/snippets) written in [miros](https://github.com/mateiadrielrafael/miros) — my custom snippet generation language
- [snippets](./home/features/neovim/snippets) written in [miros](https://github.com/prescientmoon/miros) — my custom snippet generation language
- The [flake](./flake.nix) entrypoint for this repository
## Things I use
@ -141,7 +141,7 @@ Includes links to stuff which used to be in the previous section but is not used
- [Paperplanes.nvim](https://rktjmp/paperplanes.nvim) — replaced by a single curl call
- [Eww](https://github.com/elkowar/eww) - experimented with eww for a bit, but setup was painful and bars are a bit useless
- [Neogit](https://github.com/NeogitOrg/neogit) — was a bit slow / clunky, so I switched to [lazygit](https://github.com/jesseduffield/lazygit)
- [Slambda](https://github.com/Mateiadrielrafael/slambda) — custom keyboard chording utility. I retired the project in favour of [kanata](https://github.com/jtroo/kanata)
- [Slambda](https://github.com/prescientmoon/slambda) — custom keyboard chording utility. I retired the project in favour of [kanata](https://github.com/jtroo/kanata)
- [GPG](https://gnupg.org/) + [pass](https://www.passwordstore.org/) — I switched to [vaultwarden](https://github.com/dani-garcia/vaultwarden/)
- [Agenix](https://github.com/ryantm/agenix) & [homeage](https://github.com/jordanisaacs/homeage) — I switched to [sops-nix](https://github.com/Mic92/sops-nix)
- [Mind.nvim](https://github.com/phaazon/mind.nvim) — self management tree editor. The project got archived, so I switched to [Smos](https://github.com/NorfairKing/smos).

View file

@ -1297,13 +1297,13 @@
"locked": {
"lastModified": 1713856075,
"narHash": "sha256-3nmcWGRczFJAiObkG+XUK9OdY8EVjySOUbDSK6yVyVE=",
"owner": "mateiadrielrafael",
"owner": "prescientmoon",
"repo": "miros",
"rev": "37081c34cb04b0751527c4ed740220c57cea3151",
"type": "github"
},
"original": {
"owner": "mateiadrielrafael",
"owner": "prescientmoon",
"repo": "miros",
"type": "github"
}

View file

@ -56,7 +56,7 @@
anyrun.url = "github:Kirottu/anyrun";
anyrun.inputs.nixpkgs.follows = "nixpkgs";
miros.url = "github:mateiadrielrafael/miros";
miros.url = "github:prescientmoon/miros";
miros.inputs.nixpkgs.follows = "nixpkgs";
# Spotify client with theming support

View file

@ -42,7 +42,7 @@
# }}}
extraConfig = {
github.user = "Mateiadrielrafael";
github.user = "prescientmoon";
hub.protocol = "ssh";
core.editor = "nvim";
init.defaultBranch = "main";

View file

@ -27,7 +27,7 @@ function M.setup()
-- Directory where I store my local plugin projects
path = vim.g.nix_projects_path,
patterns = { "Mateiadrielrafael" },
patterns = { "prescientmoon" },
},
performance = {
rtp = {

View file

@ -335,7 +335,7 @@ let
# }}}
# {{{ scrap
scrap = {
package = "mateiadrielrafael/scrap.nvim";
package = "prescientmoon/scrap.nvim";
event = "InsertEnter";
config.setup."my.abbreviations" = true;

View file

@ -78,7 +78,7 @@ in
name = "Dotfiles";
subtitle = "Configuration for all my machines";
logo = icon "github.png";
url = "https://github.com/mateiadrielrafael/everything-nix";
url = "https://github.com/prescientmoon/everything-nix";
}
{
name = "Cloudflare";

1
scripts/github/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
repos.json

3
scripts/github/fetch-repos.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
gh repo list --limit 200 --json name,description,url,sshUrl,owner,visibility,isArchived,isFork \
| jq > ./repos.json

65
scripts/github/rename.py Executable file
View file

@ -0,0 +1,65 @@
#!/usr/bin/env nix-shell
#!nix-shell -p python3 -i python3
import json
import os
import subprocess
import tempfile
import shutil
file_path = './repos.json'
general_org = "temporarymoon" # Get it? Because forks involve many trees, which like, form a canopy or whatever... :/
fork_org = "starlitcanopy"
future_name = "prescientmoon"
current_name = "mateiadrielrafael"
with open(file_path, 'r') as file:
data = json.load(file)
print(f"Parsed {len(data)} repos")
with tempfile.TemporaryDirectory() as temp_dir:
print(f"Temporary directory: {temp_dir}")
for repo in data:
name = repo["name"]
url = repo["url"]
org = fork_org if repo['isFork'] else general_org
fork = f"{org}/{name}"
os.chdir(temp_dir)
if repo["isFork"]:
subprocess.run(f"gh api repos/{current_name}/{name}/transfer -f new_owner={org}", shell=True)
else:
subprocess.run(f"gh repo fork {url} --clone --org {org} --default-branch-only", shell=True)
os.chdir(f"{temp_dir}/{name}")
# Create the readme if it doesn't exist
if not os.path.exists("README.md"):
with open("README.md", 'w') as file:
file.write('')
# Read the existing content of the readme
with open("README.md", 'r') as file:
existing_content = file.read()
future = f"{future_name}/{name}"
# Add disclaimer at top
text_to_prepend = f"# 🚧 This repo has been moved to [{future}](https://github.com/{future}) 🚧\n"
with open("README.md", 'w') as file:
file.write(text_to_prepend + existing_content)
# Commit changes
subprocess.run("git add .", shell=True)
subprocess.run("git commit -m 'Added movement notice to readme [skip-ci]'", shell=True)
subprocess.run("git push", shell=True)
# Fix visibility and archive repo
visibility = repo["visibility"]
if visibility != "public":
subprocess.run(f"gh repo edit {fork} --visibility {visibility}", shell=True)
subprocess.run(f"gh repo archive {fork} --yes", shell=True)
shutil.rmtree(f"{temp_dir}/{name}")
print(f"Done moving to {fork}")

2
scripts/rebuild.sh Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo nixos-rebuild switch --flake .#$hostname --show-trace --fast