Skip to content

Commit

Permalink
Revert "refactor: moving issue-assigning logic to make it re-usable"
Browse files Browse the repository at this point in the history
This reverts commit e21589c.
  • Loading branch information
olegbespalov committed Aug 23, 2023
1 parent e21589c commit 6556342
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 36 deletions.
34 changes: 0 additions & 34 deletions .github/actions/issue-assigner/action.yml

This file was deleted.

30 changes: 28 additions & 2 deletions .github/workflows/issue-auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,31 @@ jobs:
assign-user:
runs-on: ubuntu-latest
steps:
- name: Assign k6's maintainer to issue
uses: ./.github/actions/issue-assigner/
- uses: actions/github-script@v6
with:
script: |
const assignees = ['mstoykov', 'codebien', 'olegbespalov', 'oleiade'];
const assigneeCount = 1;
// Do not automatically assign users if someone was already assigned or it was opened by a maintainer
if (context.payload.issue.assignees.length > 0 || assignees.includes(context.payload.issue.user.login)) {
return;
}
const crypto = require("node:crypto");
const getNRandom = (n, array) => {
let result = new Array();
for (;n > 0 && array.length > 0; n--) {
const chosen = array[crypto.randomInt(array.length)];
result.push(chosen);
array = array.filter(el => el != chosen);
}
return result;
}
github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: getNRandom(assigneeCount, assignees),
});

0 comments on commit 6556342

Please sign in to comment.