Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-assign PRs #5258

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/pr-assignee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Auto Assign Based on Labels
on:
pull_request_target:
types: ["opened", "reopened", "ready_for_review"]

jobs:
assign_based_on_labels:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set Assignees
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const labelsToAssignees = {
'product: CLion': ['tpasternak'],
'product: IntelliJ': ['mai93'],
'product: GoLand': ['blorente'],
'product: Android Studio': ['mai93']
// Add more label-assignee mappings here
};

const labels = context.payload.pull_request.labels.map(label => label.name);
const assignees = [];

for (const label of labels) {
if (label in labelsToAssignees) {
assignees.push(...labelsToAssignees[label]);
}
}

if (assignees.length > 0) {
const issue_number = context.payload.pull_request.number;
await github.issues.addAssignees({
issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
assignees
});
}
Loading