From 6c51a82dcea909b7e4d90d6945743df9f4d0ef39 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 25 Jan 2026 19:14:07 +0300 Subject: [PATCH] some fix 2 --- .github/workflows/pipeline.yml | 62 +++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 6fb3bdc..3714185 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -161,15 +161,27 @@ jobs: const prNumber = parseInt('${{ steps.check-pr.outputs.number }}'); const branchName = context.ref.replace('refs/heads/', ''); + const commitSha = '${{ github.sha }}'; + const author = '${{ github.actor }}'; + + const updateBody = '## Updated Changes\n\n' + + 'PR updated with new commits after successful CI tests.\n\n' + + '- Latest commit: ' + commitSha + '\n' + + '- Branch: `' + branchName + '`\n' + + '- Author: @' + author + '\n\n' + + '## Test Results\n\n' + + 'โœ… All tests passed successfully!\n\n' + + 'Please review the changes and merge when ready.'; + await github.rest.pulls.update({ owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber, - title: `Merge ${branchName} into main`, - body: `## Updated Changes\n\nPR updated with new commits after successful CI tests.\n\n- Latest commit: ${{ github.sha }}\n- Branch: \`${branchName}\`\n- Author: @${{ github.actor }}\n\n## Test Results\n\nโœ… All tests passed successfully!\n\nPlease review the changes and merge when ready.` + title: 'Merge ' + branchName + ' into main', + body: updateBody }); - console.log(`โœ… PR #${prNumber} updated successfully`); + console.log('โœ… PR #' + prNumber + ' updated successfully'); - name: Create Pull Request if: steps.check-pr.outputs.exists == 'false' @@ -179,28 +191,28 @@ jobs: script: | const branchName = context.ref.replace('refs/heads/', ''); - console.log(`๐Ÿ“ Creating PR from ${branchName} to main...`); + console.log('๐Ÿ“ Creating PR from ' + branchName + ' to main...'); try { + const commitSha = '${{ github.sha }}'; + const author = '${{ github.actor }}'; + + const prBody = '## Changes\n\n' + + 'This PR was automatically created after successful CI tests.\n\n' + + '- Branch: `' + branchName + '`\n' + + '- Commit: `' + commitSha + '`\n' + + '- Author: @' + author + '\n\n' + + '## Test Results\n\n' + + 'โœ… All tests passed successfully!\n\n' + + 'Please review the changes and merge when ready.'; + const { data: pr } = await github.rest.pulls.create({ owner: context.repo.owner, repo: context.repo.repo, - title: `Merge ${branchName} into main`, + title: 'Merge ' + branchName + ' into main', head: branchName, base: 'main', - body: `## Changes - -This PR was automatically created after successful CI tests. - -- Branch: \`${branchName}\` -- Commit: \`${{ github.sha }}\` -- Author: @${{ github.actor }} - -## Test Results - -โœ… All tests passed successfully! - -Please review the changes and merge when ready.`, + body: prBody, draft: false }); @@ -213,22 +225,22 @@ Please review the changes and merge when ready.`, labels: ['automated', 'ready-for-review'] }); } catch (labelError) { - console.log(`โš ๏ธ Could not add labels: ${labelError.message}`); + console.log('โš ๏ธ Could not add labels: ' + labelError.message); } core.setOutput('number', pr.number.toString()); core.setOutput('url', pr.html_url); - console.log(`โœ… PR #${pr.number} created successfully: ${pr.html_url}`); + console.log('โœ… PR #' + pr.number + ' created successfully: ' + pr.html_url); } catch (error) { - console.error(`โŒ Failed to create PR: ${error.message}`); + console.error('โŒ Failed to create PR: ' + error.message); if (error.status === 422) { console.log('โš ๏ธ PR might already exist or branch is up to date with base'); // ะŸั€ะพะฑัƒะตะผ ะฝะฐะนั‚ะธ ััƒั‰ะตัั‚ะฒัƒัŽั‰ะธะน PR const { data: prs } = await github.rest.pulls.list({ owner: context.repo.owner, repo: context.repo.repo, - head: `${context.repo.owner}:${branchName}`, + head: context.repo.owner + ':' + branchName, base: 'main', state: 'open' }); @@ -237,10 +249,12 @@ Please review the changes and merge when ready.`, const pr = prs[0]; core.setOutput('number', pr.number.toString()); core.setOutput('url', pr.html_url); - console.log(`โœ… Found existing PR #${pr.number}: ${pr.html_url}`); + console.log('โœ… Found existing PR #' + pr.number + ': ' + pr.html_url); } else { core.setOutput('number', ''); - core.setOutput('url', `${{ github.server_url }}/${{ github.repository }}/pulls`); + const serverUrl = '${{ github.server_url }}'; + const repo = '${{ github.repository }}'; + core.setOutput('url', serverUrl + '/' + repo + '/pulls'); throw error; } } else {