Skip to content

Add splitTestsCompilation solidity setting (7): Typechain updates #1717

Add splitTestsCompilation solidity setting (7): Typechain updates

Add splitTestsCompilation solidity setting (7): Typechain updates #1717

name: PR autoassignment
on:
pull_request_target:
types: [opened]
jobs:
assign-new-issue:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/github-script@v7
with:
script: |
// each user has a chance of (p - (previousP ?? 0)) to be assigned
const potentialAssignees = [
["kanej", 1.0]
];
let assignee;
const r = Math.random();
console.log("r:", r);
for (const [username, p] of potentialAssignees) {
if (r < p) {
assignee = username;
break;
}
}
if (assignee === undefined) {
throw new Error("An assignee should've been set");
}
// Within the Github API PRs are issue objects
const pr = await github.rest.issues.get({
owner: context.issue.owner,
repo: context.issue.repo,
issue_number: context.issue.number
});
const isCollaborator = ["OWNER", "MEMBER", "COLLABORATOR"].includes(pr.data.author_association)
// we only assign PRs from external users
if (!isCollaborator) {
await github.rest.issues.addAssignees({
owner: context.issue.owner,
repo: context.issue.repo,
issue_number: context.issue.number,
assignees: [assignee],
});
}