Skip to content

Commit 0abc357

Browse files
committed
ci(translator): address second round of CodeRabbit findings
- Use max-tokens instead of max-completion-tokens: at the pinned SHA (b81b2afb) the action reads max-tokens with a 200-token default; max-completion-tokens is silently ignored, cutting off long translations mid-JSON - Fetch the live issue title before updating: context.payload.issue carries the original opened-event title which is stale on re-runs; skip the update if a maintainer has already edited the title, or if it already matches the translation
1 parent d16e599 commit 0abc357

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎.github/workflows/issue-translator.yml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/ai-inference@b81b2afb8390ee6839b494a404766bef6493c7d9 # v1
2424
with:
2525
model: openai/gpt-4o-mini
26-
max-completion-tokens: 4000
26+
max-tokens: 4000
2727
system-prompt: >
2828
You are a GitHub issue translator. Your only job is to detect the
2929
primary language of the issue and, when it is not English, produce
@@ -102,9 +102,13 @@ jobs:
102102
return;
103103
}
104104
105-
// Update the title so duplicate detection and search work in English
106-
const current = context.payload.issue.title;
107-
if (current !== title) {
105+
// Fetch live issue before updating title — the payload title is from
106+
// the original opened event and may be stale on a re-run
107+
const { data: liveIssue } = await github.rest.issues.get({ owner, repo, issue_number });
108+
const originalTitle = context.payload.issue.title;
109+
if (liveIssue.title !== originalTitle) {
110+
core.info('Title was already edited after the event; skipping title update.');
111+
} else if (liveIssue.title !== title) {
108112
await github.rest.issues.update({ owner, repo, issue_number, title });
109113
core.info(`Title updated to: ${title}`);
110114
}

0 commit comments

Comments
 (0)