chore: misc changes

main
chatton 11 months ago
parent 876dbbda02
commit 4b59a9f502

@ -0,0 +1,24 @@
#!/usr/bin/env zx
$.verbose = false;
const git = await import("./lib/git.js")
const notificationsOutput = await $`gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /notifications`
const notifications = JSON.parse(notificationsOutput.stdout);
const ibcGoNotifications = []
for (let n of notifications) {
// console.log(n);
if (git.shouldDeleteNotification(n)) {
const id = n.id;
// const resp = await $`gh api -X DELETE -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /notifications/threads/${id}/subscription`;
// console.log(resp.stdout)
console.log(n)
}
//
// if (n.repository.name === "ibc-go") {
// ibcGoNotifications.push(n);
// }
}

@ -6,7 +6,7 @@ const git = await import("./lib/git.js")
const issueNumber = process.argv[3]; const issueNumber = process.argv[3];
const issue = await $`gh issue view ${issueNumber} --repo cosmos/ibc-go --json title`; const issue = await $`gh issue view ${issueNumber} --repo cosmos/ibc-go --json title`;
const issueTitle = JSON.parse(issue).title; const issueTitle = JSON.parse(issue).title.trim();
const sanitizedTitle = git.sanitizeIssueTitle(issueTitle); const sanitizedTitle = git.sanitizeIssueTitle(issueTitle);
await $`gh pr create --web --title ${issueTitle} --base main` await $`gh pr create --web --title "${sanitizedTitle}" --base main`

@ -1,14 +1,27 @@
module.exports.shouldDeleteNotification = function (n) {
// if (n.unread === false) {
// return true
// }
module.exports = { if (n.reason === 'ci_activity') {
sanitizeIssueTitle(issueTitle) { // console.log(n)
return true
}
return false
}
module.exports.sanitizeIssueTitle = function (issueTitle) {
let sanitizedTitle = issueTitle.trim().toLowerCase() let sanitizedTitle = issueTitle.trim().toLowerCase()
sanitizedTitle = sanitizedTitle.replaceAll(".", "") sanitizedTitle = sanitizedTitle.replaceAll(".", "")
sanitizedTitle = sanitizedTitle.replaceAll(",", "") sanitizedTitle = sanitizedTitle.replaceAll(",", "")
sanitizedTitle = sanitizedTitle.replaceAll("`", "") sanitizedTitle = sanitizedTitle.replaceAll("`", "")
sanitizedTitle = sanitizedTitle.replaceAll(":", "") sanitizedTitle = sanitizedTitle.replaceAll(":", "")
sanitizedTitle = sanitizedTitle.replaceAll("-", "") sanitizedTitle = sanitizedTitle.replaceAll("-", "")
sanitizedTitle = sanitizedTitle.replaceAll("'", "")
// replace the spaces with dashes after the dashes are removed. sanitizedTitle = sanitizedTitle.replaceAll("", "")
sanitizedTitle = sanitizedTitle.replaceAll("`", "")
sanitizedTitle = sanitizedTitle.replaceAll("(", "")
sanitizedTitle = sanitizedTitle.replaceAll(")", "")
return sanitizedTitle.replaceAll(" ", "-") return sanitizedTitle.replaceAll(" ", "-")
} };
}

@ -10,7 +10,7 @@ const issue = await $`gh issue view ${issueNumber} --repo cosmos/ibc-go --json t
const issueTitle = JSON.parse(issue).title; const issueTitle = JSON.parse(issue).title;
const sanitizedTitle = git.sanitizeIssueTitle(issueTitle); const sanitizedTitle = git.sanitizeIssueTitle(issueTitle);
if (extraString !== undefined) { if (extraString) {
extraString = "-" + extraString; extraString = "-" + extraString;
} else { } else {
extraString = "" extraString = ""

Loading…
Cancel
Save