-
Notifications
You must be signed in to change notification settings - Fork 0
[Actions] Create Encrich PR Action #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Warning Rate limit exceeded@onairmarc has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 31 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughAdds a new enrichPullRequest GitHub Action implemented in Go: action metadata and Dockerfile, Go module and binaries, GitHub client support, branch-name and Jira formatting drivers, documentation, and a release workflow matrix entry. (49 words) Changes
Sequence Diagram(s)sequenceDiagram
participant Main as main
participant GH as GitHubClient
participant Strategy as Formatter (Branch / Jira)
participant JiraAPI as Jira API
participant GHAPI as GitHub API
Main->>Main: validate env (GH_REPOSITORY, PR_NUMBER, BRANCH_NAME, OPT_FMT_STRATEGY)
Main->>GH: New(owner, repo, prNumber)
GH->>GHAPI: authenticate using GH_TOKEN
Main->>Strategy: Format(gh)
alt Branch strategy
Strategy->>GH: GetBranchName()
GH-->>Strategy: branch name
Strategy->>Strategy: parse issue key/name (regex)
Strategy->>GH: BranchNameMatchesPRTitle(current)
alt mismatch
Strategy->>GH: ApplyFormatting(key, name)
GH-->>Strategy: formatted title
GH->>GHAPI: Update PR title
end
else Jira strategy
Strategy->>GH: GetBranchName()
GH-->>Strategy: branch name
Strategy->>Strategy: extract issue key
Strategy->>JiraAPI: fetch issue & parent
JiraAPI-->>Strategy: issue title/description
alt label sync enabled
Strategy->>GH: EnsureLabelExists(label,...)
GH->>GHAPI: create label if missing
GH->>GHAPI: Add label to PR
end
GH->>GHAPI: Update PR title & body (with Jira markers)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 14
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
actions/github/enrichPullRequest/go.sumis excluded by!**/*.sum
📒 Files selected for processing (8)
actions/github/enrichPullRequest/Dockerfile(1 hunks)actions/github/enrichPullRequest/action.yml(1 hunks)actions/github/enrichPullRequest/drivers/branch_name/branch_name.go(1 hunks)actions/github/enrichPullRequest/drivers/drivers.go(1 hunks)actions/github/enrichPullRequest/drivers/jira/jira.go(1 hunks)actions/github/enrichPullRequest/go.mod(1 hunks)actions/github/enrichPullRequest/main.go(1 hunks)actions/github/enrichPullRequest/support/github/github.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (2)
actions/github/enrichPullRequest/drivers/jira/jira.go (1)
Format(31-86)actions/github/enrichPullRequest/support/github/github.go (1)
GitHub(21-31)
actions/github/enrichPullRequest/main.go (4)
actions/github/enrichPullRequest/support/github/github.go (2)
GitHub(21-31)New(47-69)actions/github/enrichPullRequest/drivers/drivers.go (2)
BranchName(3-3)Jira(4-4)actions/github/enrichPullRequest/drivers/jira/jira.go (1)
Format(31-86)actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (1)
Format(17-28)
actions/github/enrichPullRequest/drivers/jira/jira.go (2)
actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (2)
Format(17-28)GetIssueKeyFromBranchName(30-40)actions/github/enrichPullRequest/support/github/github.go (1)
GitHub(21-31)
🪛 GitHub Actions: Pull Request
actions/github/enrichPullRequest/main.go
[error] 10-13: no required module provides package github.com/EncoreDigitalGroup/ci-workflows/actions/github/enrichPullRequest/drivers; to add it: go get github.com/EncoreDigitalGroup/ci-workflows/actions/github/enrichPullRequest/drivers; similarly for drivers/branch_name, drivers/jira, support/github. Also missing go.sum entry for module providing github.com/EncoreDigitalGroup/golib/logger (imported by enrichPullRequest); run 'go get' to add dependencies.
actions/github/enrichPullRequest/Dockerfile
[error] 15-17: Build failed during Go build: no required module provides package github.com/EncoreDigitalGroup/ci-workflows/actions/github/enrichPullRequest/drivers (and related subpackages) along with missing go.sum entry for golib/logger. Command: RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
There was a problem hiding this 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
♻️ Duplicate comments (2)
actions/github/enrichPullRequest/drivers/jira/jira.go (2)
68-85: Abort enrichment when Jira payload is missing.
getJiraInfosignals failures viaHasJiraInfo=false, yet we still build a[ ]-style title and push updates/labels. Return early when the Jira payload isn’t available so we never overwrite PR metadata with empty content.jira := getJiraInfo(config) + if !jira.HasJiraInfo { + logger.Errorf("Failed to retrieve Jira information for %s", issueKey) + return + } newPRTitle := gh.ApplyFormatting(issueKey, jira.Title)
72-74: Avoid double-wrapping Jira parent prefix.
getParentIssuePrefixalready returns the prefix in brackets, so wrapping it again yields titles like[[ABC-1]]. Concatenate directly to keep the format correct.- if jira.ParentPrefix != "" { - newPRTitle = fmt.Sprintf("[%s]%s", jira.ParentPrefix, newPRTitle) - } + if jira.ParentPrefix != "" { + newPRTitle = fmt.Sprintf("%s%s", jira.ParentPrefix, newPRTitle) + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/_release.yml(1 hunks)actions/github/enrichPullRequest/Dockerfile(1 hunks)actions/github/enrichPullRequest/action.yml(1 hunks)actions/github/enrichPullRequest/drivers/jira/jira.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- actions/github/enrichPullRequest/action.yml
🧰 Additional context used
🧬 Code graph analysis (1)
actions/github/enrichPullRequest/drivers/jira/jira.go (2)
actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (2)
Format(17-28)GetIssueKeyFromBranchName(30-40)actions/github/enrichPullRequest/support/github/github.go (1)
GitHub(21-31)
🪛 GitHub Actions: Pull Request
actions/github/enrichPullRequest/drivers/jira/jira.go
[error] 10-10: missing go.sum entry for module providing package github.com/ctreminiom/go-atlassian/jira/v3 (imported by github.com/EncoreDigitalGroup/ci-workflows/actions/github/enrichPullRequest/drivers/jira); to add: go get github.com/EncoreDigitalGroup/ci-workflows/actions/github/enrichPullRequest/drivers/jira
[error] 11-11: missing go.sum entry for module providing package github.com/ctreminiom/go-atlassian/pkg/infra/models (imported by github.com/EncoreDigitalGroup/ci-workflows/actions/github/enrichPullRequest/drivers/jira); to add: go get github.com/EncoreDigitalGroup/ci-workflows/actions/github/enrichPullRequest/drivers/jira
actions/github/enrichPullRequest/Dockerfile
[error] 15-15: RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . failed due to missing go.sum entries; ensure module sums are updated (e.g., 'go mod download' or 'go mod tidy')
🔇 Additional comments (4)
.github/workflows/_release.yml (1)
26-27: Matrix entry correctly formatted and properly configured.The enrichPullRequest matrix entry is correctly structured with proper YAML formatting and naming conventions. Verification confirms:
- Action files exist and are properly configured at
actions/github/enrichPullRequest- action.yml specifies the correct docker image:
ghcr.io/encoredigitalgroup/gh-action-enrich-pull-request:latest- imageName
gh-action-enrich-pull-requestmatches the docker image reference- Workflow integration is correct, passing actionPath and imageName to the release workflow
actions/github/enrichPullRequest/Dockerfile (3)
12-12: ✓ Previous critical issue resolved: full source tree now copied.The change from
COPY main.go ./toCOPY . .correctly addresses the earlier reported issue where drivers and support packages were not accessible during build.
1-41: Security and build stage practices are sound.The multi-stage build, non-root user setup, and minimal final image follow container security best practices. The alpine-based builder and final stage minimize attack surface and image size.
5-9: Original review comment is incorrect—remove this feedback.The verification confirms that
go.sumis complete (45 entries with proper hashes) and the build context is correctly configured. The CI/CD workflow runsdocker buildfromactions/github/enrichPullRequest/, makinggo.modandgo.sumaccessible at the build context root as expected by theCOPYcommand. There are no missing dependencies or build configuration issues to address.Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
actions/github/enrichPullRequest/main.go (2)
24-28: Move environment variable initialization intomain().Package-level initialization of
strategy,repo,prNumberStr,branchName, andpartsexecutes beforemain()runs. While the code happens to work becausecheckEnvVars()validatespartsbefore it's accessed, this initialization order makes the code fragile and harder to reason about.Apply this diff to move initialization into
main():-// Retrieve environment variables -var strategy = os.Getenv(envStrategy) -var repo = os.Getenv(envGHRepository) -var prNumberStr = os.Getenv(envPRNumber) -var branchName = os.Getenv(envBranchName) -var parts = strings.Split(repo, "/") - // Main function to execute the program func main() { + strategy := os.Getenv(envStrategy) + repo := os.Getenv(envGHRepository) + prNumberStr := os.Getenv(envPRNumber) + branchName := os.Getenv(envBranchName) + parts := strings.Split(repo, "/") + - checkEnvVars() + checkEnvVars(strategy, repo, prNumberStr, branchName, parts)Then update
checkEnvVarssignature to accept these parameters:-func checkEnvVars() { +func checkEnvVars(strategy, repo, prNumberStr, branchName string, parts []string) {
44-50: Add default case for invalid strategies.The strategy dispatch uses separate
ifstatements with no default case. Ifstrategydoesn't matchdrivers.BranchNameordrivers.Jira, the program silently exits without any action or warning.Apply this diff to use a switch with a default case:
- if strategy == drivers.BranchName { - branch_name.Format(gh) - } - - if strategy == drivers.Jira { + switch strategy { + case drivers.BranchName: + branch_name.Format(gh) + case drivers.Jira: jira.Format(gh) + default: + logger.Errorf("Unknown strategy: %s. Valid options are: %s, %s", strategy, drivers.BranchName, drivers.Jira) + os.Exit(1) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
actions/github/enrichPullRequest/go.sumis excluded by!**/*.sum
📒 Files selected for processing (1)
actions/github/enrichPullRequest/main.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
actions/github/enrichPullRequest/main.go (4)
actions/github/enrichPullRequest/support/github/github.go (2)
GitHub(21-31)New(47-69)actions/github/enrichPullRequest/drivers/drivers.go (2)
BranchName(3-3)Jira(4-4)actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (1)
Format(17-28)actions/github/enrichPullRequest/drivers/jira/jira.go (1)
Format(31-86)
🔇 Additional comments (2)
actions/github/enrichPullRequest/main.go (2)
1-14: LGTM!Package declaration and imports are properly structured.
53-83: LGTM!The validation logic correctly checks all required environment variables and accumulates errors before exiting, providing better user experience by reporting all missing variables at once.
There was a problem hiding this 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 (4)
docs/Actions/GitHub/enrichPullRequest.md (3)
219-232: Add language specifiers to fenced code blocks.These fenced code blocks lack language specifiers. While they represent branch name patterns rather than executable code, adding
textorplaintextimproves consistency with markdown best practices.Apply this diff:
-``` +```text epic/PROJ-123-epic-title feature/PROJ-456-new-feature bugfix/PROJ-789-bug-description hotfix/PROJ-101-critical-fix-
+text
PROJ-123-task-description
ISSUE-456-improvement-title
TICKET-789-maintenance-taskBased on static analysis hints.
283-285: Add language specifier to fenced code block.Add
textorplaintextto maintain consistency with markdown best practices.Apply this diff:
-``` +```text "key1:value1,key2:value2,key3:value3"Based on static analysis hints. --- `304-346`: **Use proper headings instead of bold text for subsections.** The troubleshooting subsections use bold text instead of proper markdown headings. This affects document structure, navigation, and accessibility. Apply this diff: ```diff -**PR Not Updated** +### PR Not Updated -**Jira Connection Issues** +### Jira Connection Issues -**Branch Pattern Mismatch** +### Branch Pattern Mismatch -**Authentication Failed** +### Authentication Failed -**Issue Not Found** +### Issue Not Found -**Permission Denied** +### Permission DeniedBased on static analysis hints.
actions/github/enrichPullRequest/main.go (1)
69-72: Consider validating repository parts are non-empty.The validation checks that
partshas exactly 2 elements, but doesn't verify thatparts[0](owner) andparts[1](repo name) are non-empty. An input like"owner/"would pass validation but result in an empty repo name. While the GitHub API client will likely reject this, catching it here would provide clearer error messages.Apply this diff:
if len(parts) != 2 { logger.Error(envGHRepository + " must be in the format owner/repo") isMissingVar = true } + + if len(parts) == 2 && (parts[0] == "" || parts[1] == "") { + logger.Error(envGHRepository + " must contain non-empty owner and repo names") + isMissingVar = true + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
actions/github/enrichPullRequest/main.go(1 hunks)docs/Actions/GitHub/enrichPullRequest.md(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
actions/github/enrichPullRequest/main.go (4)
actions/github/enrichPullRequest/support/github/github.go (2)
GitHub(21-31)New(47-69)actions/github/enrichPullRequest/drivers/drivers.go (2)
BranchName(3-3)Jira(4-4)actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (1)
Format(17-28)actions/github/enrichPullRequest/drivers/jira/jira.go (1)
Format(31-86)
🪛 LanguageTool
docs/Actions/GitHub/enrichPullRequest.md
[uncategorized] ~5-~5: The official name of this software platform is spelled with a capital “H”.
Context: ...h Pull Request Action ## Overview The actions/github/enrichPullRequest action automatically...
(GITHUB)
🪛 markdownlint-cli2 (0.18.1)
docs/Actions/GitHub/enrichPullRequest.md
219-219: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
228-228: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
283-283: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
304-304: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
310-310: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
316-316: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
324-324: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
331-331: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
339-339: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
There was a problem hiding this 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
♻️ Duplicate comments (1)
actions/github/enrichPullRequest/support/github/github.go (1)
83-96: Critical: nil dereference causes panic on API failure.This issue was flagged in a previous review and remains unresolved. When
PullRequests.Getfails on line 84,pullRequestisnil, but line 89 dereferencespullRequest.Titlewithout checking, causing a panic.Apply this diff to return early on error:
func (gh *GitHubClient) BranchNameMatchesPRTitle(currentPRTitle string) bool { pullRequest, _, err := gh.client.PullRequests.Get(context.Background(), gh.repositoryOwner, gh.repositoryName, gh.pullRequestNumber) if err != nil { - logger.Errorf("Failed to get pullRequest request: %v", err) + logger.Errorf("Failed to get pull request: %v", err) + return false } if currentPRTitle == *pullRequest.Title {
🧹 Nitpick comments (3)
actions/github/enrichPullRequest/support/github/github.go (3)
128-150: Consider extracting markers as package constants.The Jira markers are hardcoded strings. Extracting them as package-level constants would improve maintainability and allow reuse if needed elsewhere.
Additionally, the spacing logic on line 141 may produce leading/trailing double newlines when
beforeJiraorafterJiraare empty after trimming. Consider:const ( jiraStartMarker = "<!-- JIRA_SYNC_START -->" jiraEndMarker = "<!-- JIRA_SYNC_END -->" )Then in the function:
- const jiraStartMarker = "<!-- JIRA_SYNC_START -->" - const jiraEndMarker = "<!-- JIRA_SYNC_END -->"
236-260: Consider distinguishing "not found" from other API errors.The current implementation treats all
GetLabelerrors as "label doesn't exist" and proceeds to create it. Network errors or permission issues would also trigger label creation, which might fail and produce misleading error messages.If desired, check for a 404 status specifically:
_, resp, err := gh.client.Issues.GetLabel(context.Background(), gh.repositoryOwner, gh.repositoryName, labelName) if err == nil { // Label already exists return } // Check if it's a 404 (not found) vs other errors if resp != nil && resp.StatusCode != 404 { logger.Errorf("Failed to check label '%s': %v", labelName, err) return } // Label doesn't exist, proceed to create
1-287: Consider context propagation and error returns for library reuse.Currently, all API calls use
context.Background()and most methods returnvoid, logging errors rather than returning them. While acceptable for a GitHub Action context, these patterns limit testability and reusability:
- Accepting a
context.Contextparameter would enable cancellation and timeout control- Returning errors would allow callers to implement custom error handling strategies
Example for
UpdatePRTitle:func (gh *GitHubClient) UpdatePRTitle(ctx context.Context, newPRTitle string) error { fmt.Println("Attempting to Update Pull Request Title to:", newPRTitle) _, _, err := gh.client.PullRequests.Edit(ctx, gh.repositoryOwner, gh.repositoryName, gh.pullRequestNumber, &github.PullRequest{ Title: &newPRTitle, }) if err != nil { logger.Errorf("Failed to update pull request title: %v", err) return fmt.Errorf("failed to update PR title: %w", err) } logger.Infof("Updated Pull Request Title to: %s", newPRTitle) return nil }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
actions/github/enrichPullRequest/support/github/github.go(1 hunks)
🔇 Additional comments (3)
actions/github/enrichPullRequest/support/github/github.go (3)
43-70: Singleton client initialization looks good.The use of
sync.Onceto initialize a shared GitHub client is appropriate for this action's context, where the token remains constant throughout execution.
152-175: Good error handling with conditional success logging.Unlike
UpdatePRTitle, this function correctly uses anelseblock to ensure success messages are only logged when the update actually succeeds.
177-222: Exception map correctly applied.The fix from commit 5bb1388 is properly implemented. The code now correctly splits
formattedIssueName(line 213), applies exception replacements (lines 214-218), and rejoins the result (line 219) before returning.
There was a problem hiding this 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
♻️ Duplicate comments (2)
actions/github/enrichPullRequest/drivers/jira/jira.go (2)
76-88: Don't update the PR when Jira data is unavailable.
getJiraInforeturnsHasJiraInfo=falseon any fetch failure, but the code ignores this flag and proceeds to callApplyFormattingwith empty strings, producing malformed titles like[ ]. Check the flag and exit early when Jira data isn't available.jira := getJiraInfo(config) +if !jira.HasJiraInfo { + logger.Errorf("Failed to retrieve Jira issue %s", issueKey) + os.Exit(1) +} newPRTitle := gh.ApplyFormatting(issueKey, jira.Title)
80-82: Parent prefix is wrapped twice.
getParentIssuePrefixalready returns the value wrapped in brackets (e.g.,[PARENT-1]at line 134). Wrapping it again produces titles like[[PARENT-1]][ISSUE-2] .... Concatenate the prefix directly instead.if jira.ParentPrefix != "" { - newPRTitle = fmt.Sprintf("[%s]%s", jira.ParentPrefix, newPRTitle) + newPRTitle = fmt.Sprintf("%s%s", jira.ParentPrefix, newPRTitle) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
actions/github/enrichPullRequest/drivers/jira/jira.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
actions/github/enrichPullRequest/drivers/jira/jira.go (2)
actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (2)
Format(17-28)GetIssueKeyFromBranchName(30-40)actions/github/enrichPullRequest/support/github/github.go (1)
GitHub(21-32)
🔇 Additional comments (5)
actions/github/enrichPullRequest/drivers/jira/jira.go (5)
1-15: LGTM!Package declaration and imports are well-organized. The dependencies appropriately support Jira API integration and branch name parsing.
17-30: LGTM!Type definitions are clean and well-structured. The
HasJiraInfoflag inInformationprovides a clear signal for error handling.
96-113: LGTM!The Jira client creation and issue fetching helpers are straightforward with appropriate error handling and meaningful error messages.
115-176: LGTM!The parent prefix and Jira info retrieval logic is solid. The nil check for
Descriptionat line 171 properly guards against panics when issues lack descriptions. The graceful degradation for parent prefix failures (lines 163-169) is appropriate and well-documented.
178-194: LGTM!Environment variable helpers are cleanly implemented with case-insensitive boolean parsing and sensible defaults for the label name.
f9c99b3 to
255beb9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
actions/github/enrichPullRequest/support/github/github.go (1)
83-96: Critical: Nil dereference will cause panic on API error.When
PullRequests.Getfails on line 84,pullRequestis nil but execution continues to line 89 where*pullRequest.Titleis dereferenced, causing a panic. Return early after logging the error.Apply this diff:
func (gh *GitHubClient) BranchNameMatchesPRTitle(currentPRTitle string) bool { pullRequest, _, err := gh.client.PullRequests.Get(context.Background(), gh.repositoryOwner, gh.repositoryName, gh.pullRequestNumber) if err != nil { logger.Errorf("Failed to get pullRequest request: %v", err) + return false } if currentPRTitle == *pullRequest.Title {
🧹 Nitpick comments (3)
docs/Actions/GitHub/enrichPullRequest.md (3)
222-235: Add language identifier to code blocks.The code blocks at lines 222 and 231 are missing language identifiers, which triggers markdownlint warnings and reduces syntax highlighting support.
Apply this diff to add language identifiers:
-``` +```text epic/PROJ-123-epic-title feature/PROJ-456-new-feature bugfix/PROJ-789-bug-description hotfix/PROJ-101-critical-fix-
+text
PROJ-123-task-description
ISSUE-456-improvement-title
TICKET-789-maintenance-task
288-303: Add language identifier to format example.The code block at line 288 is missing a language identifier, reducing clarity and triggering linting warnings.
Apply this diff:
-``` +```text "key1:value1,key2:value2,key3:value3"--- `309-352`: **Use proper heading syntax instead of bold text.** Lines 309, 315, 321, 329, 336, and 344 use bold text (`**text**`) instead of proper Markdown heading syntax (`###`), which reduces document structure and triggers markdownlint warnings. Apply this diff to convert bold text to headings: ```diff -**PR Not Updated** +### PR Not Updated -**Jira Connection Issues** +### Jira Connection Issues -**Branch Pattern Mismatch** +### Branch Pattern Mismatch -**Authentication Failed** +### Authentication Failed -**Issue Not Found** +### Issue Not Found -**Permission Denied** +### Permission Denied
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
actions/github/enrichPullRequest/drivers/drivers.go(1 hunks)actions/github/enrichPullRequest/drivers/jira/jira.go(1 hunks)actions/github/enrichPullRequest/main.go(1 hunks)actions/github/enrichPullRequest/support/github/github.go(1 hunks)docs/Actions/GitHub/enrichPullRequest.md(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- actions/github/enrichPullRequest/drivers/drivers.go
- actions/github/enrichPullRequest/drivers/jira/jira.go
🧰 Additional context used
🧬 Code graph analysis (1)
actions/github/enrichPullRequest/main.go (4)
actions/github/enrichPullRequest/support/github/github.go (2)
GitHub(21-32)New(48-70)actions/github/enrichPullRequest/drivers/drivers.go (3)
Validate(6-19)BranchName(3-3)Jira(4-4)actions/github/enrichPullRequest/drivers/jira/jira.go (1)
Format(32-99)actions/github/enrichPullRequest/drivers/branch_name/branch_name.go (1)
Format(17-28)
🪛 LanguageTool
docs/Actions/GitHub/enrichPullRequest.md
[uncategorized] ~5-~5: The official name of this software platform is spelled with a capital “H”.
Context: ...h Pull Request Action ## Overview The actions/github/enrichPullRequest action automatically...
(GITHUB)
🪛 markdownlint-cli2 (0.18.1)
docs/Actions/GitHub/enrichPullRequest.md
222-222: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
231-231: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
288-288: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
309-309: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
315-315: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
321-321: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
329-329: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
336-336: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
344-344: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (1)
actions/github/enrichPullRequest/main.go (1)
1-84: LGTM! Clean entrypoint with proper validation.The main entrypoint follows a clear and logical flow: validation → initialization → dispatch. Error handling is consistent, all environment variables are properly validated before use, and the integration with the driver and GitHub client is clean. All previously identified issues have been addressed.
This pull request introduces a new GitHub Action called "Enrich Pull Request" that automatically updates pull request titles and descriptions using information from branch names and Jira issues. The implementation is modular, supporting different formatting strategies, and integrates with both the GitHub and Jira APIs. The most important changes are grouped below by theme.
GitHub Action Setup and Configuration
Dockerfileto build and package the Go-based action for use in GitHub workflows, including a multi-stage build for a minimal image and secure execution as a non-root user.action.ymlto define the action's inputs, outputs, and runtime configuration, enabling use of custom formatting strategies and secure environment variable passing.Core Functionality and Strategy Drivers
main.go, which reads environment variables, selects the formatting strategy (branch-nameorjira), and orchestrates the enrichment process for pull requests.drivers/branch_name/branch_name.go) and Jira integration (drivers/jira/jira.go), allowing flexible enrichment based on branch naming conventions or external issue tracking. [1] [2]drivers/drivers.gofor clear selection and extensibility of enrichment strategies.GitHub and Jira API Integration
GitHubclient interface insupport/github/github.goto handle branch name retrieval, pull request title/description updates, label management, and custom formatting logic, including support for user-defined word exceptions.Dependency Management
go.modfile specifying required dependencies for GitHub and Jira API clients, as well as supporting libraries for logging and formatting.Summary by CodeRabbit