Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add update-ignored-revisions to toolkit.nu #68

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions toolkit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ export def "test" [
nupm test
}
}

# pull down the list of `refactor` PRs that have been merged and ignore the revisions
#
# > inspired by [*How to exclude commits from git blame*](https://www.stefanjudis.com/today-i-learned/how-to-exclude-commits-from-git-blame/)
export def "update-ignored-revisions" [] {
const FILE = ".git-blame-ignore-revs"

let commits = ^gh -R amtoine/nu-git-manager pr list [
--state merged
--label refactor
--json "number,title,mergeCommit,url"
]
| from json
| select number title mergeCommit.oid url
| rename --column {mergeCommit_oid: "commit"}
| reverse
| each { $"# ($in.title): [#($in.number)]\(($in.url)\)\n($in.commit)" }
| str join "\n\n"

[
"# Run this command to always ignore formatting commits in `git blame`",
"# ```",
$"# git config blame.ignoreRevsFile ($FILE)",
"# ```",
$commits
] | str join "\n" | save --force $FILE

print $"ignored revisions stored in `($FILE)`"
}