Conversation
nashif
commented
Apr 8, 2026
- fix: if author is not assignable, the issue is still created
- append original body of PR
There was a problem hiding this comment.
Pull request overview
This PR updates the backport GitHub Action to (1) include the original PR body in generated backport PRs and (2) ensure a failure issue is still created even when the original author cannot be assigned.
Changes:
- Append the original PR body (with a header) to the generated backport PR body.
- Add a fallback when issue creation with
assignees: [author]fails, retrying issue creation unassigned.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/backport.ts
Outdated
| const templatedBody = getBody({ | ||
| base, | ||
| body: originalBody ?? "", | ||
| mergeCommitSha: commitToBackport, | ||
| number, | ||
| }); | ||
| const body = originalBody | ||
| ? `${templatedBody}\n\n---\n\n### Original PR body (#${String( | ||
| number, | ||
| )})\n\n${originalBody}` | ||
| : templatedBody; |
There was a problem hiding this comment.
originalBody is still passed into the body_template as the body variable, and then the original PR body is appended again afterwards. If a user’s body_template already includes <%= body %> (which is explicitly documented in action.yml), the backport PR body will contain the original text twice. Consider either (a) appending only when the template does not already include the body, or (b) introducing a new input/flag to control appending so existing templates aren’t affected.
| try { | ||
| await github.rest.issues.create({ | ||
| ...issuePayload, | ||
| assignees: [author], | ||
| }); | ||
| } catch { | ||
| warning( | ||
| `Could not assign issue to ${author}; creating unassigned issue instead.`, | ||
| ); | ||
| await github.rest.issues.create(issuePayload); | ||
| } |
There was a problem hiding this comment.
The catch { ... } around github.rest.issues.create({...issuePayload, assignees: [author]}) treats any failure as an “author not assignable” case and retries by creating an unassigned issue. This can misreport the real error (rate limit, auth, invalid labels, etc.) and can also create duplicate issues if the first request actually succeeded but the client threw. Capture the error, only fall back for the specific validation error related to assignees (e.g., 422), and otherwise rethrow/log the original error.
if author is not assignable (for example, not in the org/repo), the issue is still created and the action continues instead of aborting. Signed-off-by: Anas Nashif <anas.nashif@intel.com> Assisted-by: GitHub Copilot:claude-opus-4.6 Signed-off-by: Anas Nashif <anas.nashif@intel.com>