ddunny / repo1

repo1
0 stars 0 forks source link

How can I get issues that created by GithubApp Bot by using REST API? #6

Open ddunny opened 2 months ago

ddunny commented 2 months ago

I want to get my repo's issues that created by my GithubApp Bot by using REST API. It means I don't want to get the issues only created by user.

I noticed that there is a list-repository-issues api, and there is a parameter called "creator". I guess maybe I can use it, so I tried it. But failed. Is there a way to acheive that? Here is my code:

async function getIssues(githubToken: string, page: number = 1) {
    const result = await axios({
        method: 'get',
        params: {
            labels: "label",
            per_page: 20,
            page: page,
        },
        url: `https://api.github.com/repos/nyanpasuspace/maoji/issues`,
        headers: {
            accept: 'application/json',
            Authorization: `Bearer ${githubToken}`,
            'X-GitHub-Api-Version': '2022-11-28'
        },
    });
    return result.data;
}