Skip to content

Commit 3990474

Browse files
Update workflow (#3371)
1 parent e2e6ad5 commit 3990474

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

.github/workflows/changelog-pr.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,37 @@ jobs:
105105
).forEach(pr => {
106106
107107
const prLabels = pr.labels.map(label => label.name.toLowerCase());
108-
const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
108+
if (pr.user.login === "push-app-to-main") {
109+
const scriptName = pr.title;
110+
if (scriptName) {
111+
try {
112+
const { data: relatedIssues } = await github.rest.issues.listForRepo({
113+
owner: context.repo.owner,
114+
repo: "ProxmoxVED",
115+
state: "all",
116+
label: "Started Migration To ProxmoxVE",
117+
per_page: 5
118+
});
119+
const matchingIssue = relatedIssues.find(issue =>
120+
issue.title.toLowerCase().includes(scriptName.toLowerCase())
121+
);
122+
if (matchingIssue) {
123+
const issueAuthor = matchingIssue.user.login;
124+
const issueAuthorUrl = `https://github.com/${issueAuthor}`;
125+
const prNote = `- ${pr.title} [@${issueAuthor}](${issueAuthorUrl}) ([#${pr.number}](${pr.html_url}))`;
126+
} else {
127+
const prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
128+
}
129+
} catch (error) {
130+
console.error(`Error fetching related issues: ${error}`);
131+
const prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
132+
}
133+
} else {
134+
const prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`;
109135
136+
}else{
137+
const prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`;
138+
}
110139
const updateScriptsCategory = categorizedPRs.find(category =>
111140
category.labels.some(label => prLabels.includes(label))
112141
);
@@ -150,7 +179,8 @@ jobs:
150179
const hasSubcategories = subCategories && subCategories.length > 0;
151180
const hasMainNotes = notes.length > 0;
152181
const hasSubNotes = hasSubcategories && subCategories.some(sub => sub.notes && sub.notes.length > 0);
153-
182+
183+
154184
155185
if (hasMainNotes || hasSubNotes) {
156186
newReleaseNotes += `### ${title}\n\n`;

0 commit comments

Comments
 (0)