Fixed issue with Gitea

This commit is contained in:
Bhavik MacBook PRO 16 2023-04-06 10:07:03 +05:30
commit 7af7c49a6e
3 changed files with 25 additions and 21 deletions

22
dist/index.js vendored
View file

@ -39230,17 +39230,19 @@ async function run() {
const repoOwner = github.context.payload.repository.owner.login; const repoOwner = github.context.payload.repository.owner.login;
const prNumber = github.context.payload.number || github.context.payload.issue.number; // get number from a pull request event or comment event const prNumber = github.context.payload.number || github.context.payload.issue.number; // get number from a pull request event or comment event
// Get the code to analyze from the review comment // Get the code to analyze from the review comment
var content = comment && comment.body || "";
const url = `${githubBaseURL}/${repoOwner}/${repoName}/pulls/${prNumber}`;
core.debug(`diff url: ${url}`); var content = comment && comment.body || '';
var response = await axios.get(url, {
headers: { const url = `${giteaBaseURL}/api/v1/repos/${repoOwner}/${repoName}/pulls/${prNumber}/diff`;
Authorization: `Bearer ${githubToken}`, console.log(`diff url: ${url}`);
Accept: 'application/vnd.github.diff' var response = await axios.get(url, {
} headers: {
}); Authorization: `token ${giteaToken}`,
Accept: 'application/vnd.github.diff'
}
});
const code = response.data; const code = response.data;
core.debug(`diff code: ${code}`); core.debug(`diff code: ${code}`);
const files = parsePullRequestDiff(code); const files = parsePullRequestDiff(code);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -44,17 +44,19 @@ async function run() {
const repoOwner = github.context.payload.repository.owner.login; const repoOwner = github.context.payload.repository.owner.login;
const prNumber = github.context.payload.number || github.context.payload.issue.number; // get number from a pull request event or comment event const prNumber = github.context.payload.number || github.context.payload.issue.number; // get number from a pull request event or comment event
// Get the code to analyze from the review comment // Get the code to analyze from the review comment
var content = comment && comment.body || "";
const url = `${githubBaseURL}/${repoOwner}/${repoName}/pulls/${prNumber}`;
core.debug(`diff url: ${url}`); var content = comment && comment.body || '';
var response = await axios.get(url, {
headers: { const url = `${giteaBaseURL}/api/v1/repos/${repoOwner}/${repoName}/pulls/${prNumber}/diff`;
Authorization: `Bearer ${githubToken}`, console.log(`diff url: ${url}`);
Accept: 'application/vnd.github.diff' var response = await axios.get(url, {
} headers: {
}); Authorization: `token ${giteaToken}`,
Accept: 'application/vnd.github.diff'
}
});
const code = response.data; const code = response.data;
core.debug(`diff code: ${code}`); core.debug(`diff code: ${code}`);
const files = parsePullRequestDiff(code); const files = parsePullRequestDiff(code);