Fixed issue with Comment on Gitea

This commit is contained in:
Bhavik MacBook PRO 16 2023-04-23 19:34:08 +05:30
parent ba5b9a6177
commit 015e6a0826
3 changed files with 21 additions and 11 deletions

15
dist/index.js vendored
View file

@ -39357,14 +39357,19 @@ async function run() {
// Make a POST request to create a comment on a pull request // Make a POST request to create a comment on a pull request
const comment = answerTemplate.replace('${answer}', answer);
const url = `${githubBaseURL}/api/v1/repos/${repoOwner}/${repoName}/issues/${prNumber}/comments`; const url = `${githubBaseURL}/api/v1/repos/${repoOwner}/${repoName}/issues/${prNumber}/comments`;
const headers = { 'Content-Type': 'application/json', 'Authorization': `token ${githubToken}` }; const headers = { 'Content-Type': 'application/json', 'Authorization': `token ${githubToken}` };
const data = { 'body': answerTemplate.replace('${answer}', answer)}; const data = { 'body': `${comment}`};
core.debug(`url: ${url}`); core.debug(`url: ${url}`);
core.debug(`headers: ${headers}`); core.debug(`githubToken: ${githubToken}`);
core.debug(`data: ${data}`); core.debug(`data.body: ${data.body}`);
var response = await axios.post(url, data, { headers }); var response = await axios.post(url, data, {
headers: {
Authorization: `token ${githubToken}`,
Accept: 'application/json'
}
});
} }
} catch (error) { } catch (error) {
core.setFailed(error.message); core.setFailed(error.message);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -171,14 +171,19 @@ async function run() {
// Make a POST request to create a comment on a pull request // Make a POST request to create a comment on a pull request
const comment = answerTemplate.replace('${answer}', answer);
const url = `${githubBaseURL}/api/v1/repos/${repoOwner}/${repoName}/issues/${prNumber}/comments`; const url = `${githubBaseURL}/api/v1/repos/${repoOwner}/${repoName}/issues/${prNumber}/comments`;
const headers = { 'Content-Type': 'application/json', 'Authorization': `token ${githubToken}` }; const headers = { 'Content-Type': 'application/json', 'Authorization': `token ${githubToken}` };
const data = { 'body': answerTemplate.replace('${answer}', answer)}; const data = { 'body': `${comment}`};
core.debug(`url: ${url}`); core.debug(`url: ${url}`);
core.debug(`headers: ${headers}`); core.debug(`githubToken: ${githubToken}`);
core.debug(`data: ${data}`); core.debug(`data.body: ${data.body}`);
var response = await axios.post(url, data, { headers }); var response = await axios.post(url, data, {
headers: {
Authorization: `token ${githubToken}`,
Accept: 'application/json'
}
});
} }
} catch (error) { } catch (error) {
core.setFailed(error.message); core.setFailed(error.message);