Skip to content

Add version number to PR comment footer#17

Merged
warengonzaga merged 3 commits intomainfrom
copilot/add-version-number-to-footer
Jan 2, 2026
Merged

Add version number to PR comment footer#17
warengonzaga merged 3 commits intomainfrom
copilot/add-version-number-to-footer

Conversation

Copy link
Contributor

Copilot AI commented Jan 2, 2026

Implementation Plan: Add Version Number to PR Comment Footer

  • Explore repository structure and understand the codebase
  • Identify where the PR comment footer is generated (scripts/pr-comment.js:361-362)
  • Confirm version source (package.json has version: "1.0.0")
  • Read the version from package.json in pr-comment.js
  • Update the footer text to include the version number (format: "v{version}")
  • Manually test the changes to verify correct output
  • Request code review
  • Run security checks (CodeQL: 0 alerts)
  • Address code review feedback - Move require statements to top of file

Summary of Changes

Added version number to PR comment footer with improved code organization following Node.js best practices.

Latest Changes (refactor):

  • Moved fs and path require statements to the top of the file (after comments, before module.exports)
  • Removed duplicate require('fs') from inside the generateSecuritySection function
  • Improves code organization and makes dependencies clearer

Original Implementation:

  • Reads version from package.json with fallback to '1.0.0'
  • Updates footer template to include v${actionVersion}

Footer Output:

🤖 Powered by Container Build Flow Action v1.0.0

Testing:

  • ✅ Module loads without syntax errors
  • ✅ Functionality intact after refactoring
  • ✅ Version correctly appears in footer
  • ✅ All require statements now at top of file following Node.js best practices
Original prompt

This section details on the original issue you should resolve

<issue_title>Add Version Number to PR Comment Footer</issue_title>
<issue_description>Problem:
Currently, the PR comment footer shows "🤖 Powered by Container Build Flow Action" but doesn't indicate which version of the action is being used. This makes it difficult to know which version is running in a project at a glance.

Suggestion:
Update the PR comment footer to include the version number, like:

🤖 Powered by Container Build Flow Action v1.X.X

Benefits:

  • Quick visibility into which version is running
  • Easier troubleshooting and debugging
  • Better traceability across different projects

Implementation:
Append the version number (e.g., v1.X.X) to the existing footer text without modifying anything else. </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Summary by CodeRabbit

  • Improvements
    • PR comments now display the action version for better transparency and tracking purposes.
    • Enhanced error handling to gracefully manage version retrieval, ensuring continuous operation.

✏️ Tip: You can customize this high-level summary in your review settings.

Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Copilot AI changed the title [WIP] Add version number to PR comment footer Add version number to PR comment footer Jan 2, 2026
Copilot AI requested a review from warengonzaga January 2, 2026 15:24
@warengonzaga warengonzaga marked this pull request as ready for review January 2, 2026 15:24
@warengonzaga warengonzaga requested a review from Copilot January 2, 2026 15:24
@warengonzaga warengonzaga removed their request for review January 2, 2026 15:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds version information to the PR comment footer to improve visibility and traceability of which action version is running. The version is read from package.json at runtime with appropriate fallback handling.

Key changes:

  • Reads version from package.json with error handling and fallback to v1.0.0
  • Updates footer template to display version in format v{version}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@warengonzaga
Copy link
Member

@copilot apply changes based on the comments in this thread

Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
@warengonzaga
Copy link
Member

@CodeRabbit review

@coderabbitai
Copy link

coderabbitai bot commented Jan 2, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor Author

Copilot AI commented Jan 2, 2026

@copilot apply changes based on the comments in this thread

Applied the changes in commit a060259. The fs and path require statements have been moved to the top of the file (after the header comments, before module.exports), and the duplicate require('fs') has been removed from the generateSecuritySection function. The code now follows Node.js best practices for module imports.

@coderabbitai
Copy link

coderabbitai bot commented Jan 2, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

The pull request modifies scripts/pr-comment.js to incorporate the action's version number into the PR comment footer. The implementation involves adding top-level imports for filesystem operations, reading the version from package.json, and appending this version to the footer text with appropriate error handling and fallback mechanisms.

Changes

Cohort / File(s) Summary
Version Integration
scripts/pr-comment.js
Introduces top-level imports for fs and path; reads action version from package.json with fallback to 1.0.0; appends version to footer text ("🤖 Powered by Container Build Flow Action vX.X.X"); includes try-catch error handling for version retrieval; removes redundant local fs require statement

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

workflow


Very good, sir. If I may be so bold, this modification represents a most effortless enhancement to the action's transparency. The version number shall now be seamlessly conveyed to all who review the pull request comments, requiring minimal cognitive effort on the user's part whilst providing maximum clarity. The error handling ensures the system continues to function gracefully should the version retrieval encounter any difficulties.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary objective of the pull request: adding version number to the PR comment footer.
Linked Issues check ✅ Passed The implementation successfully addresses issue #16 by reading the version from package.json, appending it to the footer text in format v1.X.X, and including it in the PR comment template.
Out of Scope Changes check ✅ Passed The refactoring of require statements to top-level imports and removal of duplicate require('fs') are supplementary improvements that support the main objective without introducing unrelated functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/add-version-number-to-footer

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6765d1c and a060259.

📒 Files selected for processing (1)
  • scripts/pr-comment.js
🔇 Additional comments (3)
scripts/pr-comment.js (3)

21-22: Excellent reorganization, sir.

The module imports have been properly elevated to the top of the file, following Node.js conventions and addressing the previous code review feedback. Dependencies are now immediately clear to anyone reading the code.


373-374: Mission accomplished, sir.

The footer now includes the action version in the requested format (v${actionVersion}), providing immediate visibility into which version is running. This enhancement delivers the traceability and troubleshooting benefits outlined in issue #16 without disrupting the existing footer structure.


37-45: The implementation demonstrates exemplary defensive programming.

The version extraction mechanism is exceedingly well-executed. Verification confirms that package.json exists at the repository root with a properly formatted semantic version (1.0.0), and the path construction—path.join(__dirname, '..', 'package.json')—correctly navigates from the scripts directory to retrieve it. The error handling is appropriately sophisticated: graceful fallback to the hardcoded '1.0.0', coupled with unobtrusive diagnostic logging via core.debug. The code requires no modifications.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@warengonzaga warengonzaga merged commit 7f0d62a into main Jan 2, 2026
1 check passed
@warengonzaga warengonzaga deleted the copilot/add-version-number-to-footer branch January 2, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Version Number to PR Comment Footer

3 participants