Skip to content

Add serverUrl for self hosted GitHub#234

Merged
MishaKav merged 1 commit intomainfrom
claude/add-serverurl-option-01ApKJyADrGNmYjHnzyJDGS2
Nov 15, 2025
Merged

Add serverUrl for self hosted GitHub#234
MishaKav merged 1 commit intomainfrom
claude/add-serverurl-option-01ApKJyADrGNmYjHnzyJDGS2

Conversation

@MishaKav
Copy link
Owner

Implemented automatic server URL detection to support self-hosted GitHub instances

  • serverUrl is automatically calculated from context.serverUrl
  • Falls back to 'https://github.com' for standard GitHub
  • Updated repoUrl construction to use serverUrl for file links
  • Added logging to show which GitHub URL is being used

This allows users running GitHub Enterprise Server or other self-hosted GitHub instances to have coverage report links point to the correct server automatically, without requiring any additional configuration.

Implemented automatic server URL detection to support self-hosted GitHub
instances, matching the jest-coverage-comment implementation exactly.

- serverUrl is automatically calculated from context.serverUrl
- Falls back to 'https://github.com' for standard GitHub
- Updated repoUrl construction to use serverUrl for file links
- Added logging to show which GitHub URL is being used

This allows users running GitHub Enterprise Server or other self-hosted
GitHub instances to have coverage report links point to the correct server
automatically, without requiring any additional configuration.
@coderabbitai
Copy link

coderabbitai bot commented Nov 15, 2025

Walkthrough

The change modifies src/index.js to make the server URL configurable. A new local variable serverUrl is introduced that reads from context.serverUrl with a default value of 'https://github.com'. This value is logged and then used to dynamically construct options.repoUrl, replacing the previously hardcoded GitHub URL. The existing fallback behavior to use the repository path when payload.repository?.html_url is unavailable is preserved.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single file affected with straightforward variable substitution
  • Addition of a configuration-driven variable with sensible default
  • Minimal logic change with preserved fallback behavior
  • No structural or architectural modifications

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description covers the main functionality and rationale, but is missing required checklist items (Tested locally, Ran npm run all, Updated docs) that are specified in the template. Complete the checklist section from the template by marking items as done or noting why they don't apply to this change.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add serverUrl for self hosted GitHub' directly describes the main change in the pull request, which introduces serverUrl detection for self-hosted GitHub instances.
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 claude/add-serverurl-option-01ApKJyADrGNmYjHnzyJDGS2

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.

@github-actions
Copy link
Contributor

Coverage

Coverage Report
FileStmtsMissCoverMissing
functions/example_completed
   example_completed.py641970%33, 39–45, 48–51, 55–58, 65–70, 91–92
functions/example_manager
   example_manager.py441175%31–33, 49–55, 67–69
   example_static.py40295%60–61
functions/my_exampels
   example.py20200%1–31
functions/resources
   resources.py26260%1–37
TOTAL105573930% 

Tests Skipped Failures Errors Time
109 2 💤 1 ❌ 0 🔥 0.583s ⏱️

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 implements automatic server URL detection to support self-hosted GitHub instances (like GitHub Enterprise Server). The change ensures that coverage report file links point to the correct GitHub server without requiring additional configuration.

  • Introduced automatic detection of GitHub server URL via context.serverUrl
  • Updated repository URL construction to use the detected server URL
  • Added informational logging to show which GitHub URL is being used

Reviewed Changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/index.js Added serverUrl extraction from context with fallback to standard GitHub, updated repoUrl construction, and added logging
dist/index.js Compiled version of the source file changes

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/index.js (1)

203-203: Fix branding inconsistency.

The log message uses "Github" but the correct branding is "GitHub" (with capital H).

Apply this diff:

-  core.info(`Uses Github URL: ${serverUrl}`);
+  core.info(`Uses GitHub URL: ${serverUrl}`);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dda025d and 6c18680.

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**
📒 Files selected for processing (1)
  • src/index.js (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

Run ESLint on all JavaScript source files under src

Files:

  • src/index.js
src/{utils,index}.js

📄 CodeRabbit inference engine (CLAUDE.md)

Enforce GitHub comment maximum length of 65,536 characters when creating/updating PR comments

Files:

  • src/index.js
src/index.js

📄 CodeRabbit inference engine (CLAUDE.md)

src/index.js: Support filtering to show only changed files in the current commit when generating reports/comments
Use comment watermarking to update an existing PR comment instead of creating duplicates
Generate an HTML coverage report with repository file links for inclusion in the PR comment

Files:

  • src/index.js
🧠 Learnings (3)
📚 Learning: 2025-08-30T12:36:01.248Z
Learnt from: CR
Repo: MishaKav/pytest-coverage-comment PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-30T12:36:01.248Z
Learning: Applies to src/index.js : Generate an HTML coverage report with repository file links for inclusion in the PR comment

Applied to files:

  • src/index.js
📚 Learning: 2025-08-30T12:36:01.248Z
Learnt from: CR
Repo: MishaKav/pytest-coverage-comment PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-30T12:36:01.248Z
Learning: Applies to src/index.js : Use comment watermarking to update an existing PR comment instead of creating duplicates

Applied to files:

  • src/index.js
📚 Learning: 2025-08-30T12:36:01.248Z
Learnt from: CR
Repo: MishaKav/pytest-coverage-comment PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-30T12:36:01.248Z
Learning: Applies to src/{utils,index}.js : Enforce GitHub comment maximum length of 65,536 characters when creating/updating PR comments

Applied to files:

  • src/index.js
🔇 Additional comments (1)
src/index.js (1)

235-235: Verification complete—no issues found.

The dynamic serverUrl construction at line 235 correctly propagates through the codebase. The parse functions in src/parse.js (lines 299, 331) properly use the options.repoUrl parameter passed from src/index.js, ensuring self-hosted instance support is maintained. The hardcoded URL at line 106 is documentation text in a help message, which is appropriate. No functional hardcoded GitHub URLs remain in the coverage report generation logic.

@MishaKav MishaKav merged commit c026f3a into main Nov 15, 2025
11 checks passed
@MishaKav MishaKav deleted the claude/add-serverurl-option-01ApKJyADrGNmYjHnzyJDGS2 branch November 15, 2025 15:20
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.

3 participants