mirror of
https://github.com/ingress-it-solutions/gitea-code-review-action.git
synced 2025-04-20 11:06:47 +00:00
Added code for Gitea
This commit is contained in:
parent
be1c0ee191
commit
c6912e4ece
3 changed files with 25 additions and 5 deletions
10
dist/index.js
vendored
10
dist/index.js
vendored
|
@ -39201,6 +39201,14 @@ function configWithProxy(config) {
|
||||||
return c;
|
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() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
// Get input values
|
// Get input values
|
||||||
|
@ -39353,6 +39361,8 @@ async function run() {
|
||||||
} else if (sourceAt === 'gitea')
|
} else if (sourceAt === 'gitea')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const comment = answerTemplate.replace('${answer}', answer);
|
||||||
|
await createCommentOnPullRequest(repoOwner, repoName, prNumber, comment);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
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
10
index.js
10
index.js
|
@ -15,6 +15,14 @@ function configWithProxy(config) {
|
||||||
return c;
|
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() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
// Get input values
|
// Get input values
|
||||||
|
@ -167,6 +175,8 @@ async function run() {
|
||||||
} else if (sourceAt === 'gitea')
|
} else if (sourceAt === 'gitea')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const comment = answerTemplate.replace('${answer}', answer);
|
||||||
|
await createCommentOnPullRequest(repoOwner, repoName, prNumber, comment);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue