Open favna opened 6 months ago
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs
. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
Can you share a code example
Can you share a code example
I linked to a GitHub repo with a code example but sure I guess...
import { App } from '@octokit/app';
const jobId = 1; // INSERT REAL GITHUB ACTION JOB ID HERE
const app = new App({
appId: 123,
privateKey: '-----BEGIN PRIVATE KEY-----\n...',
webhooks: {
secret: 'secret'
}
});
app.webhooks.on('workflow_run.completed', async ({ octokit }) => {
// This will throw as mentioned
const jobLogsData = await octokit.request('GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs', {
owner: 'octokit',
repo: 'app.js',
job_id: jobId,
headers: {
'X-GitHub-Api-Version': '2022-11-28',
Accept: 'application/vnd.github+json'
}
});
console.log(jobLogsData.url);
});
What happened?
I noticed that when requesting the job logs with
GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs
using @octokit/app a 403 error is thrown, even though when logging the response in a catch block the URL is returned anyway. I used this as logs: https://github.com/sapphiredev/sapphiredev/blob/a7fa7bc367c04d88b6115437703010086b7cd2dc/src/processGitHubWebhookRequest.ts#L161-L176Versions
true
Relevant log output
Code of Conduct