How to refer to a github repo wiki with octokit

13 Views Asked by At

Using Octokit I can retrieve commits for the base repository. Here's the code for that. The values passed for owner and repo parameters are "PDConSec" and "vsc-print" and being the admin I have a suitable PAT defined in an environment variable on my workstation.

const octokit = new Octokit({ auth: process.env.PRINT_PAT });

async function getPreviousCommitSha(owner, repo) {
    try {
        // Get the list of commits from the default branch (usually 'main' or 'master')
        const { data } = await octokit.rest.repos.listCommits({
            owner,
            repo,
            per_page: 2, // Fetch the latest two commits
        });

GitHub repos have associated with them a wiki repo. You can clone it to edit the files locally. I did, and here's the redacted content of the corresponding .git/config

[remote "origin"]
    url = https://[email protected]/PDConSec/vsc-print.wiki.git
    fetch = +refs/heads/*:refs/remotes/origin/*

I want to retrieve the last two commits for this wiki repo. I tried the repo name vsc-print.wiki but I keep getting the message Not Found - https://docs.github.com/rest/commits/commits#list-commits which you get for any invalid repo name.

What repo name should one use to refer to the wiki associated with a given repo?

0

There are 0 best solutions below