Skip to content

Commit f9f3341

Browse files
authored
Update base reference check for release tags
Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
1 parent 3bc8082 commit f9f3341

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/scripts/release-pr-coderabbit-gate.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ module.exports = async ({ github, context }) => {
9191
const headRef = pr.head?.ref || "";
9292

9393
// Optional sanity check: base should look like a tag. If it doesn't, still comment but warn.
94-
const baseLooksLikeTag = baseRef.startsWith("v") && /\d+\.\d+\.\d+/.test(baseRef);
94+
const baseLooksLikeTag = baseRef.startsWith("release-v") && /\d+\.\d+\.\d+/.test(baseRef);
9595

9696
const issue_number = pr.number;
9797
if (await commentAlreadyExists({ github, owner, repo, issue_number })) {
@@ -102,7 +102,7 @@ module.exports = async ({ github, context }) => {
102102
const prompt = loadPrompt();
103103

104104
const body = buildBody({ prompt, baseRef, headRef }) +
105-
(baseLooksLikeTag ? "" : "\n\n⚠️ Note: base ref does not look like a release tag. For full release diff, set base to the previous tag (e.g. v0.1.10).");
105+
(baseLooksLikeTag ? "" : "\n\n⚠️ Note: base ref does not look like a release tag. For full release diff, set base to the previous tag (e.g. release-v0.1.10).");
106106

107107
await github.rest.issues.createComment({
108108
owner,
@@ -112,8 +112,10 @@ module.exports = async ({ github, context }) => {
112112
});
113113

114114
console.log("Posted CodeRabbit release-gate comment.");
115+
console.log(`PR #${issue_number} (${headRef}${baseRef})`);
115116
} catch (error) {
116117
console.error(`Error in release PR coderabbit gate: ${error.message}`);
118+
console.log(`PR #${issue_number} (${headRef}${baseRef})`);
117119
// Fail silently; this is a non-critical enhancement.
118120
}
119121
};

0 commit comments

Comments
 (0)