Something went wrong. Try again.
My original and customized Noctalia plugins.
Something went wrong. Try again.
2.2 kB · 62 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263-- Adapted from Shangshui0302's GitHub Kanban (MIT).-- Read-only argv requests; no shell interpolation or notification mutations.local Activity = require("./activity.luau")local GitHub = {}function GitHub.profile() return { "gh", "api", "user", "--jq", "{id, login, name}", "--hostname", "github.com" }endfunction GitHub.repositories() return { "gh", "api", "user/repos?sort=updated&per_page=50", "--jq", "[.[] | {full_name, description, html_url, updated_at}]", "--hostname", "github.com", }endfunction GitHub.work(kind, repository) local query = repository ~= "" and ("repo:" .. repository) or "involves:@me" query ..= "+is:open+is:" .. (kind == "pulls" and "pr" or "issue") return { "gh", "api", "search/issues?q=" .. query .. "&sort=updated&per_page=30", "--jq", "{items: [.items[] | {number, title, repository_url, user: {login: .user.login}, state, html_url, updated_at}]}", "--hostname", "github.com", }endfunction GitHub.notifications(page) return { "gh", "api", "notifications?all=true&per_page=50&page=" .. tostring(page or 1), "--jq", "[.[] | {id, subject, repository: {full_name: .repository.full_name}, reason, unread, updated_at}]", "--hostname", "github.com", }endfunction GitHub.contributions() local collections = {} local months = Activity.months() for i, month in ipairs(months) do local nextDate = Activity.monthEnd(months, i) table.insert( collections, "activity" .. tostring(i) .. ': contributionsCollection(from: "' .. month.date .. '-01T00:00:00Z", to: "' .. nextDate .. '") { startedAt totalCommitContributions totalPullRequestContributions totalIssueContributions totalRepositoryContributions }' ) end local query = "query { viewer { login " .. table.concat(collections, " ") .. " } }" return { "gh", "api", "graphql", "-f", "query=" .. query, "--hostname", "github.com" }endreturn GitHub