mirror of
https://github.com/ingress-it-solutions/gitea-code-review-action.git
synced 2025-04-20 03:06:44 +00:00
Added code for Gitea
This commit is contained in:
parent
be1c0ee191
commit
c6912e4ece
3 changed files with 25 additions and 5 deletions
14
dist/index.js
vendored
14
dist/index.js
vendored
|
@ -39201,6 +39201,14 @@ function configWithProxy(config) {
|
|||
return c;
|
||||
}
|
||||
|
||||
// Make a POST request to create a comment on a pull request
|
||||
const createCommentOnPullRequest = async (repoOwner, repoName, prNumber, comment) => {
|
||||
const url = `${giteaBaseURL}/repos/${repoOwner}/${repoName}/issues/${prNumber}/comments`;
|
||||
const headers = { 'Authorization': `token ${giteaToken}` };
|
||||
const data = { 'body': comment };
|
||||
await axios.post(url, data, { headers });
|
||||
}
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
// Get input values
|
||||
|
@ -39351,9 +39359,11 @@ async function run() {
|
|||
|
||||
});
|
||||
} else if (sourceAt === 'gitea')
|
||||
{
|
||||
{
|
||||
|
||||
}
|
||||
const comment = answerTemplate.replace('${answer}', answer);
|
||||
await createCommentOnPullRequest(repoOwner, repoName, prNumber, comment);
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
14
index.js
14
index.js
|
@ -15,6 +15,14 @@ function configWithProxy(config) {
|
|||
return c;
|
||||
}
|
||||
|
||||
// Make a POST request to create a comment on a pull request
|
||||
const createCommentOnPullRequest = async (repoOwner, repoName, prNumber, comment) => {
|
||||
const url = `${giteaBaseURL}/repos/${repoOwner}/${repoName}/issues/${prNumber}/comments`;
|
||||
const headers = { 'Authorization': `token ${giteaToken}` };
|
||||
const data = { 'body': comment };
|
||||
await axios.post(url, data, { headers });
|
||||
}
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
// Get input values
|
||||
|
@ -165,9 +173,11 @@ async function run() {
|
|||
|
||||
});
|
||||
} else if (sourceAt === 'gitea')
|
||||
{
|
||||
{
|
||||
|
||||
}
|
||||
const comment = answerTemplate.replace('${answer}', answer);
|
||||
await createCommentOnPullRequest(repoOwner, repoName, prNumber, comment);
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue