Skip to content

ci: auto-assign PR to its author#6538

Merged
M1nd3r merged 1 commit into
mainfrom
m1nd3r/auto-assing-pr-s
Mar 2, 2026
Merged

ci: auto-assign PR to its author#6538
M1nd3r merged 1 commit into
mainfrom
m1nd3r/auto-assing-pr-s

Conversation

@M1nd3r
Copy link
Copy Markdown
Contributor

@M1nd3r M1nd3r commented Feb 28, 2026

This PR adds an action that auto-assigns opened PR to its author.

This implementation uses actions/github-script@v8.

Alternatively, we could use Auto Assign Action that was developed by kentaro-m. I have opted for not adding a new dependency - even though the repository exist for more than 7 years and seems to be actively maintained.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61577a8 and 79fc2ab.

📒 Files selected for processing (1)
  • .github/workflows/bot-auto-assign.yml

Walkthrough

A GitHub Actions workflow is added to auto-assign the PR author when a pull request is opened in the trezor/trezor-firmware repository. The workflow runs a JavaScript snippet (actions/github-script@v8) that reads the PR author's login and calls the Issues API to add the author as an assignee. It includes error handling that logs a non-fatal message if the assignment fails (for example, if the author isn't a collaborator). The workflow requests pull-requests: write permissions.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as GitHub Actions Workflow
    participant Script as actions/github-script
    participant API as GitHub REST API (Issues)
    participant Repo as Repository (Issue/PR)
    Workflow->>Script: trigger on pull_request opened (PR `#N`)
    Script->>API: GET pull request author (login)
    API-->>Script: returns author login
    Script->>API: POST issues.addAssignees{owner, repo, issue_number, assignees:[login]}
    API-->>Script: 200 OK or error
    Script->>Workflow: log success or non-fatal error
    Script->>Repo: author added as assignee (if successful)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description explains the PR purpose and implementation choice but does not follow the repository's template structure for core developers (PR setup, development status, post-merge status). Consider following the repository's PR template by adding sections for PR setup, development status, and post-merge status as specified in the template guidelines.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'ci: auto-assign PR to its author' clearly and concisely summarizes the main change - adding CI automation to auto-assign PRs to their authors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch m1nd3r/auto-assing-pr-s

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@trezor-bot trezor-bot Bot added this to Firmware Feb 28, 2026
@M1nd3r M1nd3r requested a review from obrusvit February 28, 2026 02:00
@github-project-automation github-project-automation Bot moved this to 🔎 Needs review in Firmware Feb 28, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 28, 2026

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 22511359114

@M1nd3r M1nd3r added the ci Continuous Integration (CI) related label Feb 28, 2026
@M1nd3r M1nd3r marked this pull request as ready for review February 28, 2026 02:08
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a 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 (1)
.github/workflows/bot-auto-assign.yml (1)

17-17: Pin actions/github-script to a full commit SHA.

Line 17 uses a mutable tag (@v8). Pinning to a SHA improves supply-chain integrity and reproducibility.

Suggested change
-      - name: Assign PR author to PR
-        uses: actions/github-script@v8
+      - name: Assign PR author to PR
+        uses: actions/github-script@<FULL_COMMIT_SHA> # v8
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bot-auto-assign.yml at line 17, Replace the mutable
actions/github-script@v8 reference with a pinned full commit SHA: locate the
workflow step that says "uses: actions/github-script@v8" and update it to use
the specific commit SHA for that release (e.g.,
actions/github-script@<full-commit-sha>) so the workflow is immutable and
reproducible; ensure you choose the official commit SHA from the
actions/github-script repository and run/validate the workflow after updating.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/bot-auto-assign.yml:
- Around line 22-31: The try/catch currently swallows all failures; change the
add-assignee logic to capture and inspect the API response from
github.rest.issues.addAssignees (e.g., the returned response object and its
data/assignees or status) to detect when the API accepted the request but did
not actually add the user (non-collaborator) and log that case with core.info
including author, while only treating true API/network/authentication errors
(non-2xx responses or thrown exceptions) as errors (use core.error or rethrow).
Locate the call to github.rest.issues.addAssignees and the surrounding catch
block and update handling to check response.data.assignees (or response.status)
for the presence of author before deciding between core.info and core.error.

---

Nitpick comments:
In @.github/workflows/bot-auto-assign.yml:
- Line 17: Replace the mutable actions/github-script@v8 reference with a pinned
full commit SHA: locate the workflow step that says "uses:
actions/github-script@v8" and update it to use the specific commit SHA for that
release (e.g., actions/github-script@<full-commit-sha>) so the workflow is
immutable and reproducible; ensure you choose the official commit SHA from the
actions/github-script repository and run/validate the workflow after updating.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfec181 and 61577a8.

📒 Files selected for processing (1)
  • .github/workflows/bot-auto-assign.yml

Comment thread .github/workflows/bot-auto-assign.yml
@M1nd3r M1nd3r force-pushed the m1nd3r/auto-assing-pr-s branch from 61577a8 to 79fc2ab Compare February 28, 2026 02:24
Copy link
Copy Markdown
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

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

LGTM code-wise.

I think it's also OK process-wise but CCing @zktex @Hannsek to be sure.

Please consider adding this to bot-project-automation.yml instead of a new file.

@obrusvit
Copy link
Copy Markdown
Contributor

obrusvit commented Mar 2, 2026

We have some process automation which is configured directly in Github web UI.
Can't this be done that way instead of creating additional .yml workflow? @zktex

If not, then we can merge this :)
Thanks 👍

@M1nd3r
Copy link
Copy Markdown
Contributor Author

M1nd3r commented Mar 2, 2026

Please consider adding this to bot-project-automation.yml instead of a new file.

@mmilata
Personally, I would not do that, as I see no benefit in doing so. Project automation has different prerequisites - requires more permissions and handles auth tokens.

There is also the existence of a third bot - bot-common-sync - which is also separate from bot-project-automation.

@zktex
Copy link
Copy Markdown

zktex commented Mar 2, 2026

The built-in workflows don't have this option, so this is the way to go. 👍

@M1nd3r M1nd3r merged commit 6b63f38 into main Mar 2, 2026
106 checks passed
@M1nd3r M1nd3r deleted the m1nd3r/auto-assing-pr-s branch March 2, 2026 16:35
@github-project-automation github-project-automation Bot moved this from 🔎 Needs review to 🤝 Needs QA in Firmware Mar 2, 2026
@M1nd3r M1nd3r moved this from 🤝 Needs QA to ✅ Done (no QA) in Firmware Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration (CI) related

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants