Skip to content

Commit

Permalink
testing with PR
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Panayil <[email protected]>
  • Loading branch information
sachin-panayil committed Dec 20, 2024
1 parent d9534c3 commit c09f750
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 31 deletions.
34 changes: 19 additions & 15 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,24 +715,28 @@ function run(disableRetry) {
core.info(`Lables: ${LABELS} `);
try {
const [owner, repo] = REPO.split('/');
const originalLables = LABELS.replace(/\s/g, "");
const cleanedLabels = originalLables.split(",");
const jsonOutput = repolinter_1.jsonFormatter.formatOutput(result, true);
const files = getFileChanges_1.getFileChanges(jsonOutput);
if (Object.keys(files).length !== 0) {
// const pr = await octokit.createPullRequest({
// owner,
// repo,
// title: `Repolinter Results`,
// body: getPRBody(result),
// base: BASE_BRANCH,
// head: `repolinter-results-#${RUN_NUMBER}`,
// changes: [{
// files,
// commit: `changes based on repolinter output`
// }]
// })
// if (pr) {
// core.info(`Created PR: ${pr.data.html_url}`)
// }
const pr = yield octokit.createPullRequest({
owner,
repo,
title: `Repolinter Results`,
body: getPRBody(result),
base: BASE_BRANCH,
head: `repolinter-results-#${RUN_NUMBER}`,
labels: cleanedLabels,
changes: [{
files,
commit: `changes based on repolinter output`
}]
});
if (pr) {
core.info(`Created PR: ${pr.data.html_url}`);
core.info(`Labels: ${LABELS}`);
}
}
else {
console.log("No changes detected");
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

35 changes: 20 additions & 15 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,31 @@ export default async function run(disableRetry?: boolean): Promise<void> {

try {
const [owner, repo] = REPO.split('/')
const originalLables = LABELS.replace(/\s/g, "");
const cleanedLabels = originalLables.split(",")

const jsonOutput = jsonFormatter.formatOutput(result, true)
const files = getFileChanges(jsonOutput)

if (Object.keys(files).length !== 0) {
// const pr = await octokit.createPullRequest({
// owner,
// repo,
// title: `Repolinter Results`,
// body: getPRBody(result),
// base: BASE_BRANCH,
// head: `repolinter-results-#${RUN_NUMBER}`,
// changes: [{
// files,
// commit: `changes based on repolinter output`
// }]
// })
const pr = await octokit.createPullRequest({
owner,
repo,
title: `Repolinter Results`,
body: getPRBody(result),
base: BASE_BRANCH,
head: `repolinter-results-#${RUN_NUMBER}`,
labels: cleanedLabels,
changes: [{
files,
commit: `changes based on repolinter output`
}]
})

// if (pr) {
// core.info(`Created PR: ${pr.data.html_url}`)
// }
if (pr) {
core.info(`Created PR: ${pr.data.html_url}`)
core.info(`Labels: ${LABELS}`)
}

} else {
console.log("No changes detected")
Expand Down

0 comments on commit c09f750

Please sign in to comment.