Merge dev-4 into main #4

Merged
KerradKerridi merged 5 commits from dev-4 into main 2026-01-25 16:58:22 +00:00
Showing only changes of commit 6c51a82dce - Show all commits

View File

@@ -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 {