Skip to content

Commit

Permalink
new new
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Panayil <[email protected]>
  • Loading branch information
sachin-panayil committed Nov 26, 2024
1 parent 745fac2 commit d6c027a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
33 changes: 21 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,18 +628,27 @@ function run(disableRetry) {
core.startGroup('Sending a PR');
const [owner, repo] = REPO.split('/');
try {
const { execSync } = __nccwpck_require__(63129);
const branchName = `repolinter/updates-${RUN_NUMBER}`;
execSync(`git checkout -b ${branchName}`);
execSync('git add .');
execSync('git commit -m "Repolinter automated updates"');
execSync(`git push origin ${branchName}`);
const prOutput = execSync(`gh pr create \
--title "Repolinter Automated Updates" \
--body "This PR contains automated updates from Repolinter checks" \
--base main \
--head ${branchName}`).toString();
core.info(`Pull request created: ${prOutput}`);
// Create or update PR using octokit-plugin-create-pull-request
const prResponse = yield octokit.createPullRequest({
owner,
repo,
title: 'test repolinter title',
body: "this will haev the output in a bit",
base: "main",
head: `repolinter-${RUN_NUMBER}`,
changes: [{
files: {
"": null
},
commit: "test commit message"
}]
});
if (prResponse) {
core.info(`Created PR: ${prResponse.data.html_url}`);
}
else {
core.info('No changes detected, skipping PR creation');
}
}
catch (error) {
core.error('Failed to create pull request');
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

41 changes: 22 additions & 19 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,28 @@ export default async function run(disableRetry?: boolean): Promise<void> {
const [owner, repo] = REPO.split('/')

try {
const { execSync } = require('child_process');

const branchName = `repolinter/updates-${RUN_NUMBER}`;
execSync(`git checkout -b ${branchName}`);

execSync('git add .');
execSync('git commit -m "Repolinter automated updates"');

execSync(`git push origin ${branchName}`);

const prOutput = execSync(
`gh pr create \
--title "Repolinter Automated Updates" \
--body "This PR contains automated updates from Repolinter checks" \
--base main \
--head ${branchName}`
).toString();

core.info(`Pull request created: ${prOutput}`);

// Create or update PR using octokit-plugin-create-pull-request
const prResponse = await octokit.createPullRequest({
owner,
repo,
title: 'test repolinter title',
body: "this will haev the output in a bit",
base: "main",
head: `repolinter-${RUN_NUMBER}`,
changes: [{
files: {
"": null
},
commit: "test commit message"
}]
})

if (prResponse) {
core.info(`Created PR: ${prResponse.data.html_url}`)
} else {
core.info('No changes detected, skipping PR creation')
}
} catch (error) {
core.error('Failed to create pull request')
throw error
Expand Down

0 comments on commit d6c027a

Please sign in to comment.