Skip to content

refactor: delegate pr-impact-analysis to Cloudflare Worker#82

Open
originalix wants to merge 2 commits intoOneKeyHQ:mainfrom
originalix:fix/pr-analysis-v1
Open

refactor: delegate pr-impact-analysis to Cloudflare Worker#82
originalix wants to merge 2 commits intoOneKeyHQ:mainfrom
originalix:fix/pr-analysis-v1

Conversation

@originalix
Copy link
Contributor

Summary

  • Simplify pr-impact-analysis GitHub Action from a full analysis engine to a thin HTTP client
  • All LLM analysis, Jira dedup search, and issue creation logic now handled by a deployed Cloudflare Worker
  • Reduce action inputs from 11 to 3 (github-token, worker-url, worker-secret)
  • Upgrade runtime from node16 to node20
  • Remove analyzer.js (168 lines) and jira.js (115 lines), keep github.js unchanged

Test plan

  • Verify Worker endpoint is reachable with correct auth
  • Trigger action on a test PR and confirm Jira issue creation
  • Verify OK-XXXX skip logic still works (handled by Worker now)
  • Verify skip_qa scenarios return correct outputs
  • Confirm dedup logic catches duplicate issues

🤖 Generated with Claude Code

Simplify the GitHub Action to a thin client that collects PR data
and POSTs to a Cloudflare Worker. All LLM analysis, Jira dedup,
and issue creation logic now lives in the Worker.

- Reduce inputs from 11 to 3 (github-token, worker-url, worker-secret)
- Upgrade runtime from node16 to node20
- Remove analyzer.js and jira.js (moved to Worker)
- Keep github.js unchanged (PR data + diff collection)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@revan-zhang
Copy link
Collaborator

revan-zhang commented Mar 5, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f58db3a73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

core.setOutput('jira-issue-key', data.jiraIssueKey || '');
core.setOutput('jira-issue-url', data.jiraIssueUrl || '');
core.setOutput('analysis-summary', data.analysisSummary || '');
core.setOutput('skipped', String(data.skipped));

Choose a reason for hiding this comment

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

P2 Badge Validate skipped output is boolean before publishing

The action writes skipped as String(data.skipped) without validating the worker response shape, so a partial response like { "success": true } produces the literal output "undefined" even though action.yml documents this output as true/false. Downstream workflow conditions that compare steps.<id>.outputs.skipped to 'true'/'false' will misroute while the step still reports success, making worker contract drift hard to detect.

Useful? React with 👍 / 👎.

Comment on lines +31 to +32
core.setOutput('jira-issue-key', data.jiraIssueKey || '');
core.setOutput('jira-issue-url', data.jiraIssueUrl || '');

Choose a reason for hiding this comment

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

P1 Badge Reject non-skipped success responses without Jira key

After data.success passes, the code always sets outputs and exits successfully even when data.skipped is false but jiraIssueKey/jiraIssueUrl are empty; this silently reports "Done" while no QA ticket was actually created. In the previous in-action flow, Jira creation failures threw and failed the job, so this introduces a regression where worker-side creation errors can be masked as successful runs.

Useful? React with 👍 / 👎.

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.

2 participants