From b1f51e2d34e3cd866a0c76569e379f11408ac867 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Mon, 24 Mar 2025 15:28:39 +0100 Subject: [PATCH] Fix Workflow (#3387) --- .github/workflows/changelog-pr.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/changelog-pr.yml b/.github/workflows/changelog-pr.yml index 9041e2e8b..96982070c 100644 --- a/.github/workflows/changelog-pr.yml +++ b/.github/workflows/changelog-pr.yml @@ -107,36 +107,38 @@ jobs: for (const pr of filteredPRs) { const prLabels = pr.labels.map(label => label.name.toLowerCase()); - - let prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`; - - if (pr.user.login.includes("push-app-to-main[bot]")) { + const scriptName = pr.title; try { const { data: relatedIssues } = await github.rest.issues.listForRepo({ owner: context.repo.owner, repo: "ProxmoxVED", state: "all", - labels: ["Started Migration To ProxmoxVE"], - per_page: 5 + labels: ["Started Migration To ProxmoxVE"] }); + const matchingIssue = relatedIssues.find(issue => issue.title.toLowerCase().includes(scriptName.toLowerCase()) ); + if (matchingIssue) { const issueAuthor = matchingIssue.user.login; const issueAuthorUrl = `https://github.com/${issueAuthor}`; prNote = `- ${pr.title} [@${issueAuthor}](${issueAuthorUrl}) ([#${pr.number}](${pr.html_url}))`; } + else { + prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`; + } } catch (error) { console.error(`Error fetching related issues: ${error}`); prNote = `- ${pr.title} ([#${pr.number}](${pr.html_url}))`; } + }else{ + prNote = `- ${pr.title} [@${pr.user.login}](https://github.com/${pr.user.login}) ([#${pr.number}](${pr.html_url}))`; } - if (prLabels.includes("new script")) { const newScriptCategory = categorizedPRs.find(category => category.title === "New Scripts" || category.labels.includes("new script")); @@ -174,7 +176,7 @@ jobs: } return await main(); - + - name: Update CHANGELOG.md uses: actions/github-script@v7 with: