Skip to content

Commit

Permalink
fix: Update dependencies and improve PR body formatting with enhanced…
Browse files Browse the repository at this point in the history
… summary and details
  • Loading branch information
iamvikshan committed Nov 23, 2024
1 parent ef1ae24 commit ed98b4e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 27 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,20 @@ jobs:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: npm install
run: bun i

- name: Build
run: npm run build
run: bun run build

- name: Run tests
continue-on-error: true
run: npm run test
run: bun run test

- name: Semantic Release
env:
Expand All @@ -53,7 +58,7 @@ jobs:
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_COMMITTER_NAME: ${{ github.actor }}
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
run: npx semantic-release
run: bunx semantic-release

# Add step to publish to GitHub Marketplace
- name: Publish to GitHub Marketplace
Expand Down
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

All notable changes to this project will be documented in this file.


# [v1.1.8](https://github.com/vixshan/link-updater/compare/v1.1.7...v1.1.8) (2024-11-23)



## [1.1.8](https://github.com/vixshan/link-updater/compare/v1.1.7...v1.1.8) (2024-11-23)

### Bug Fixes

* Enhance configuration module for Update Links GitHub Action with detailed documentation and validation functions ([436c5f5](https://github.com/vixshan/link-updater/commit/436c5f53b658f0ab7b6aad0d4675502c804c2e62))
- Enhance configuration module for Update Links GitHub Action with detailed documentation and
validation functions
([436c5f5](https://github.com/vixshan/link-updater/commit/436c5f53b658f0ab7b6aad0d4675502c804c2e62))

# [v1.1.7](https://github.com/vixshan/link-updater/compare/v1.1.6...v1.1.7) (2024-11-22)

Expand Down
27 changes: 19 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34803,19 +34803,30 @@ function generatePrBody() {
acc[change.file].push(change);
return acc;
}, {});
let body = '## Link Updates\n\n';
// Add summary
body += `This PR updates ${linkProcessor_1.linkChanges.length} link${linkProcessor_1.linkChanges.length === 1 ? '' : 's'} across ${Object.keys(changesByFile).length} file${Object.keys(changesByFile).length === 1 ? '' : 's'}.\n\n`;
const fileCount = Object.keys(changesByFile).length;
let body = '# 🔄 Link Updates\n\n';
// Add summary with emoji and better formatting
body += `📊 **Summary**\n`;
body += `- Total updates: \`${linkProcessor_1.linkChanges.length}\` link${linkProcessor_1.linkChanges.length === 1 ? '' : 's'}\n`;
body += `- Files modified: \`${fileCount}\` file${fileCount === 1 ? '' : 's'}\n\n`;
// Add details for each file
body += `## 📝 Changes by File\n\n`;
for (const [file, changes] of Object.entries(changesByFile)) {
body += `### ${file}\n`;
// Extract just the filename from the full path
const fileName = file.split('/').pop() || file;
body += `### 📄 \`${fileName}\`\n\n`;
body += `<details>\n<summary>View ${changes.length} change${changes.length === 1 ? '' : 's'}</summary>\n\n`;
// Create a table for the changes
body += '| Original | Updated |\n';
body += '|----------|---------||\n';
for (const change of changes) {
body += `- \`${change.oldLink}\` \`${change.newLink}\`\n`;
body += `| \`${change.oldLink}\` | \`${change.newLink}\` |\n`;
}
body += '\n';
body += '\n</details>\n\n';
}
body += '---\n';
body += '_This PR was automatically generated by the Link Updater._';
body += '---\n\n';
body +=
'> 🤖 *This PR was automatically generated by the [Link Updater](https://github.com/vixshan/link-updater).*';
return body;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@semantic-release/release-notes-generator": "^14.0.1",
"@types/jest": "^29.5.14",
"@types/js-yaml": "^4.0.9",
"@types/node": "^22.9.1",
"@types/node": "^22.9.2",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"@vercel/ncc": "^0.38.3",
Expand All @@ -60,7 +60,7 @@
"semantic-release-gitmoji": "^1.6.8",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.3",
"typescript": "^5.7.2",
"typescript-eslint": "^8.15.0"
},
"eslintConfig": {
Expand Down
29 changes: 21 additions & 8 deletions src/prCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,35 @@ function generatePrBody(): string {
{} as Record<string, LinkChange[]>
)

let body = '## Link Updates\n\n'
const fileCount = Object.keys(changesByFile).length
let body = '# 🔄 Link Updates\n\n'

// Add summary
body += `This PR updates ${linkChanges.length} link${linkChanges.length === 1 ? '' : 's'} across ${Object.keys(changesByFile).length} file${Object.keys(changesByFile).length === 1 ? '' : 's'}.\n\n`
// Add summary with emoji and better formatting
body += `📊 **Summary**\n`
body += `- Total updates: \`${linkChanges.length}\` link${linkChanges.length === 1 ? '' : 's'}\n`
body += `- Files modified: \`${fileCount}\` file${fileCount === 1 ? '' : 's'}\n\n`

// Add details for each file
body += `## 📝 Changes by File\n\n`
for (const [file, changes] of Object.entries(changesByFile)) {
body += `### ${file}\n`
// Extract just the filename from the full path
const fileName = file.split('/').pop() || file
body += `### 📄 \`${fileName}\`\n\n`
body += `<details>\n<summary>View ${changes.length} change${changes.length === 1 ? '' : 's'}</summary>\n\n`

// Create a table for the changes
body += '| Original | Updated |\n'
body += '|----------|---------||\n'
for (const change of changes) {
body += `- \`${change.oldLink}\` \`${change.newLink}\`\n`
body += `| \`${change.oldLink}\` | \`${change.newLink}\` |\n`
}
body += '\n'

body += '\n</details>\n\n'
}

body += '---\n'
body += '_This PR was automatically generated by the Link Updater._'
body += '---\n\n'
body +=
'> 🤖 *This PR was automatically generated by the [Link Updater](https://github.com/vixshan/link-updater).*'

return body
}

0 comments on commit ed98b4e

Please sign in to comment.