Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12430,8 +12430,6 @@ const run = async () => {
}
);

let commits = "";

if (compare_commits?.data?.commits?.length === 0) {
commits = "";
return;
Expand All @@ -12453,6 +12451,8 @@ const run = async () => {
console.log(error?.message);
}

console.log(commits);

// attempt to create PR
try {
let options = {
Expand All @@ -12476,28 +12476,31 @@ const run = async () => {
},
],
};
const createpr = await createorupdatepr({
branch: branch_name,
body: commits,
owner: context.payload?.repository?.owner?.login,
repo: context.payload?.repository?.name,
full_name: context.payload?.repository?.full_name,
});
if (createpr?.data) {
axios
.post(SLACK_WEBHOOK_URL, JSON.stringify(options))
.then((response) => {
console.log("SUCCEEDED: Sent slack webhook", response.data);
})
.catch((error) => {
console.log("FAILED: Send slack webhook", error);
});
return;
if (commits != "") {
const createpr = await createorupdatepr({
branch: branch_name,
body: commits,
owner: context.payload?.repository?.owner?.login,
repo: context.payload?.repository?.name,
full_name: context.payload?.repository?.full_name,
});
if (createpr?.data) {
axios
.post(SLACK_WEBHOOK_URL, JSON.stringify(options))
.then((response) => {
console.log("SUCCEEDED: Sent slack webhook", response.data);
})
.catch((error) => {
console.log("FAILED: Send slack webhook", error);
});
return;
}
} else {
console.log("No commits to create this PR");
}
} catch (error) {
console.log("error", error?.message);
}

// update PR
try {
const options = {
Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 1.0.2
* test bump version actions
# 1.0.1
* test manually update version

* reset bump version actions
# 1.0.1
* new test
# 1.0.1
* fix typo
# 1.0.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "automate-pull-request",
"version": "1.0.6",
"version": "1.0.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
42 changes: 23 additions & 19 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ const run = async () => {
}
);

let commits = "";

if (compare_commits?.data?.commits?.length === 0) {
commits = "";
return;
Expand All @@ -56,6 +54,8 @@ const run = async () => {
console.log(error?.message);
}

console.log(commits);

// attempt to create PR
try {
let options = {
Expand All @@ -79,23 +79,27 @@ const run = async () => {
},
],
};
const createpr = await createorupdatepr({
branch: branch_name,
body: commits,
owner: context.payload?.repository?.owner?.login,
repo: context.payload?.repository?.name,
full_name: context.payload?.repository?.full_name,
});
if (createpr?.data) {
axios
.post(SLACK_WEBHOOK_URL, JSON.stringify(options))
.then((response) => {
console.log("SUCCEEDED: Sent slack webhook", response.data);
})
.catch((error) => {
console.log("FAILED: Send slack webhook", error);
});
return;
if (commits != "") {
const createpr = await createorupdatepr({
branch: branch_name,
body: commits,
owner: context.payload?.repository?.owner?.login,
repo: context.payload?.repository?.name,
full_name: context.payload?.repository?.full_name,
});
if (createpr?.data) {
axios
.post(SLACK_WEBHOOK_URL, JSON.stringify(options))
.then((response) => {
console.log("SUCCEEDED: Sent slack webhook", response.data);
})
.catch((error) => {
console.log("FAILED: Send slack webhook", error);
});
return;
}
} else {
console.log("No commits to create this PR");
}
} catch (error) {
console.log("error", error?.message);
Expand Down