Skip to content

Commit a60d4e4

Browse files
chore: sync workflow templates from Workflows repo
Automated sync from stranske/Workflows Template hash: cbc7a4cd85f8 Changes synced from sync-manifest.yml
1 parent d64783e commit a60d4e4

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/scripts/agents_pr_meta_update_body.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,28 @@ function resolveAgentType({ inputs = {}, env = {}, pr = {} } = {}) {
452452
return '';
453453
}
454454

455+
function prLabelNames(pr = {}) {
456+
return new Set(
457+
(Array.isArray(pr.labels) ? pr.labels : [])
458+
.map((label) => normalise(typeof label === 'string' ? label : label?.name))
459+
.filter(Boolean),
460+
);
461+
}
462+
463+
function isReleasePleasePr(pr = {}) {
464+
const labels = prLabelNames(pr);
465+
const title = normalise(pr.title);
466+
const body = normalise(pr.body);
467+
const headRef = normalise(pr.head?.ref || pr.headRefName);
468+
469+
return (
470+
headRef.startsWith('release-please--branches--') ||
471+
labels.has('autorelease: pending') ||
472+
/^chore\([^)]*\):\s*release\b/i.test(title) ||
473+
/\brelease-please\b/i.test(body)
474+
);
475+
}
476+
455477
/**
456478
* Merge checkbox states from existingStates into newContent.
457479
* Only unchecked items `- [ ]` in newContent get their state restored.
@@ -1380,6 +1402,11 @@ async function run({github: rawGithub, context, core, inputs}) {
13801402
return;
13811403
}
13821404

1405+
if (isReleasePleasePr(pr)) {
1406+
core.info(`PR #${pr.number} is a release-please PR; skipping issue-sourced PR body sync.`);
1407+
return;
1408+
}
1409+
13831410
const sourceContext = resolvePrSourceContext(pr);
13841411
const issueNumber = sourceContext.issueNumber;
13851412
if (sourceContext.noAutomation) {
@@ -1702,6 +1729,8 @@ module.exports = {
17021729
buildPreamble,
17031730
buildSourceContextRepairCommentBody,
17041731
buildSourceContextResolvedCommentBody,
1732+
prLabelNames,
1733+
isReleasePleasePr,
17051734
resolveExplicitNonIssueWorkflowSourceContext,
17061735
extractExplicitIssueSyncNumbers,
17071736
hasExplicitIssueSyncReference,

0 commit comments

Comments
 (0)