Skip to content

chore: bump @eslint/js from 9.13.0 to 9.16.0 in /apps/main-cli #609

chore: bump @eslint/js from 9.13.0 to 9.16.0 in /apps/main-cli

chore: bump @eslint/js from 9.13.0 to 9.16.0 in /apps/main-cli #609

Workflow file for this run

name: Self Assign Issue
on:
issue_comment:
types:
- created
jobs:
assign:
runs-on: ubuntu-latest
steps:
- name: Check for command
id: find_command
uses: actions/github-script@v4
with:
github-token: ${{secrets.My_SEC}}
script: |
const commentBody = context.payload.comment.body;
const assignUsing = '/assignme';
const isCommandPresent = commentBody.includes(assignUsing);
const commenter = context.payload.comment.user.login;
const isSelf = commenter === 'Puskar-Roy';
const hasAssignees = context.payload.issue.assignees.length > 0;
console.log(`Comment Body: ${commentBody}`);
console.log(`Command Present: ${isCommandPresent}`);
console.log(`Commenter: ${commenter}`);
console.log(`Is Self: ${isSelf}`);
console.log(`Assignees: ${context.payload.issue.assignees.map(assignee => assignee.login)}`);
if (isCommandPresent && isSelf) {
console.log('Command present in comment by self, ignoring');
console.log('::set-output name=toAssign::false');
} else if (isCommandPresent && hasAssignees) {
console.log('Command present, issue already assigned');
const { owner, repo, number } = context.issue;
const commentBody = `Hey @${commenter}, the issue has already been assigned and cannot be assigned to you again. Feel free to work on another issue or create a new one.😥
`;
github.issues.createComment({ owner, repo, issue_number: number, body: commentBody });
console.log('::set-output name=toAssign::false');
} else if (isCommandPresent) {
console.log('Command present, assigning the issue');
console.log('::set-output name=toAssign::true');
} else {
console.log('Command not present, nothing to do');
console.log('::set-output name=toAssign::false');
}
- name: Assign the issue
if: steps.find_command.outputs.toAssign == 'true'
id: assign_issue
uses: actions/github-script@v4
with:
github-token: ${{ secrets.MY_SEC}}
script: |
const { owner, repo, number } = context.issue;
const assignee = context.payload.comment.user.login;
await github.issues.addAssignees({ owner, repo, issue_number: number, assignees: [assignee] });
console.log(`Assigned the issue to ${assignee}.`);