Skip to content

Conversation

tomassrnka
Copy link
Member

@tomassrnka tomassrnka commented Oct 15, 2025

Adds Slack notifications on PR assignment

It uses emails as handler link between github and slack since usernames do not match, but mails do :).

Once the automation picks the assignee for PR review it sends a slack message:

  You've been assigned to review PR #123: Fix authentication bug
  https://github.com/e2b-dev/infra/pull/123

  Formatted message (what they see in Slack):
  You've been assigned to review PR #123         [clickable link]

Note

Sends Slack DMs to newly assigned PR reviewers and adds CODEOWNERS-based assignee fallback when the author isn’t in configured teams, updating the workflow to include Slack deps and token.

  • CI/GitHub Action (.github/actions/auto-request-same-site/script.js):
    • Slack notifications:
      • Integrate Slack Web API and send DMs to assigned reviewers with PR link/title.
      • Map GitHub users to Slack via GitHub email lookup (limited to @e2b.dev).
      • Requires SLACK_BOT_TOKEN.
    • Assignee selection:
      • Add CODEOWNERS parsing and use as fallback when author isn’t in eng-sf/eng-prg.
      • Preserve team-based selection; exclude author/already-assigned and pick randomly.
  • Workflow (.github/workflows/auto-request-same-site.yml):
    • Install @slack/web-api and pass SLACK_BOT_TOKEN to the action.

Written by Cursor Bugbot for commit bf0e020. This will update automatically on new commits. Configure here.

@tomassrnka
Copy link
Member Author

bugbot run

return;
}

assignees = pickRandom(candidates, needed);
Copy link

Choose a reason for hiding this comment

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

Bug: CODEOWNERS Parsing Fails with Team References

The parseCodeowners function extracts both individual usernames and team references from CODEOWNERS. Since the GitHub API for adding assignees only accepts individual usernames, attempting to assign team references causes the API call to fail.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

we don't use teams in CODEOWNERS, so ok

// Read and parse CODEOWNERS file
let codeownersContent;
try {
codeownersContent = fs.readFileSync("CODEOWNERS", "utf8");
Copy link

Choose a reason for hiding this comment

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

Bug: CODEOWNERS Parsing Ignores Non-Root Locations

The CODEOWNERS parsing logic currently only checks the repository root for the file. GitHub supports CODEOWNERS in three standard locations (root, .github/, and docs/), so the action fails to find files in .github/ or docs/. This prevents the fallback assignment logic from working correctly when the PR author isn't in a configured team.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

this is ok

}

const email = await getGitHubUserEmail(githubUsername);
if (!email || !email.endsWith("@e2b.dev")) {
Copy link
Member

Choose a reason for hiding this comment

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

this won't work if the primary email isn't e2b.dev

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, i will take a look at this, seems like via GraphQL you can query all mails..

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