[GH-ISSUE #2415] Code Cleanup : Regex for github.com and GHE can be unified to a single one #1113

Closed
opened 2026-03-01 21:48:59 +03:00 by kerem · 1 comment
Owner

Originally created by @kavishdahekar on GitHub (Aug 2, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2415

Currently, the findGitSlug method relies on two separate regexes for identifying a github.com or a GHE domain from a given repo URL.

  1. Although findGitSlug returns either "CodeCommit", "GitHub" or "GitHubEnterprise" - this return value is never used elsewhere.
  2. The code does not differentiate between github.com and GHE domain elsewhere, so a single regex is sufficient to extract both : ^https?://([^/]+)/(.+)/(.+?)(?:\.git)?$

If acceptable, I would be happy to make this fix and modify the tests.

Originally created by @kavishdahekar on GitHub (Aug 2, 2024). Original GitHub issue: https://github.com/nektos/act/issues/2415 Currently, the [`findGitSlug`](https://github.com/nektos/act/blob/bda491e406db6c85865498ced18764bc00491a5e/pkg/common/git/git.go#L201C6-L201C17) method relies on two separate regexes for identifying a `github.com` or a GHE domain from a given repo URL. 1. Although `findGitSlug` returns either `"CodeCommit"`, `"GitHub"` or `"GitHubEnterprise"` - this return value is never used elsewhere. 2. The code does not differentiate between `github.com` and GHE domain elsewhere, so a single regex is sufficient to extract both : `^https?://([^/]+)/(.+)/(.+?)(?:\.git)?$` If acceptable, I would be happy to make this fix and modify the tests.
kerem 2026-03-01 21:48:59 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jan 30, 2025):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2623220001 --> @github-actions[bot] commented on GitHub (Jan 30, 2025): Issue is stale and will be closed in 14 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1113
No description provided.