Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
.github/workflows/auto-assign.yml
StratoSDK / .github / workflows / auto-assign.yml
1name: Dynamic Auto Assign
2on:
3 issues:
4 types: [opened]
5 pull_request:
6 types: [opened]
7 
8jobs:
9 assign:
10 runs-on: ubuntu-latest
11 permissions:
12 issues: write
13 pull-requests: write
14 steps:
15 - name: 'Assign dynamically'
16 uses: actions/github-script@v7
17 with:
18 github-token: ${{ secrets.GITHUB_TOKEN }}
19 script: |
20
21 const { data: collaborators } = await github.rest.repos.listCollaborators({
22 owner: context.repo.owner,
23 repo: context.repo.repo,
24 });
25 
26
27 const eligible = collaborators
28 .filter(c => c.permissions.push)
29 .map(c => c.login);
30 
31 if (eligible.length === 0) return;
32 
33
34 const assignee = eligible[Math.floor(Math.random() * eligible.length)];
35 
36
37 const number = context.payload.issue
38 ? context.payload.issue.number
39 : context.payload.pull_request.number;
40 
41
42 await github.rest.issues.addAssignees({
43 owner: context.repo.owner,
44 repo: context.repo.repo,
45 issue_number: number,
46 assignees: [assignee],
47 });
48