Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
feature(main): add issue comment (#46)
Browse files Browse the repository at this point in the history
Signed-off-by: cuisongliu <cuisongliu@qq.com>
  • Loading branch information
cuisongliu authored Jun 27, 2023
1 parent 03a9bf9 commit fd4c720
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/test-pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,27 @@ jobs:
return;
}
const milestone = pr.milestone.title;
const cherryPickCmd = `/cherry-pick ${milestone}-release`;
const ref = `heads/release-${milestone}`;
let branchExists;
try {
await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref
});
branchExists = true;
} catch (error) {
if (error.status === 404) {
console.log(`Branch ${ref} does not exist. Skipping...`);
branchExists = false;
} else {
throw error; // Rethrow if it's another error
}
}
if (!branchExists) {
return;
}
const cherryPickCmd = `/cherry-pick release-${milestone}`;
console.log(`Adding comment: ${cherryPickCmd}`);
await github.rest.issues.createComment({
owner: context.repo.owner,
Expand Down

0 comments on commit fd4c720

Please sign in to comment.