Skip to content

[Feature] Invite Functionality for Others. #273

[Feature] Invite Functionality for Others.

[Feature] Invite Functionality for Others. #273

name: Assign Issue
on:
issue_comment:
types: [created]
jobs:
assign:
runs-on: ubuntu-latest
steps:
- name: Check if mention and label exist
id: check_mentions
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const mentions = context.payload.comment.body.match(/@([a-zA-Z0-9_-]+)/g);
const label = context.payload.comment.body.match(/#([a-zA-Z0-9_-]+)/g);
return { mentions, label };
- name: Assign to mentioned users
if: ${{ steps.check_mentions.outputs.mentions != null }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const assignees = context.payload.comment.user.login;
await github.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
assignees: assignees
});
- name: Add label if mentioned
if: ${{ steps.check_mentions.outputs.label != null }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const label = context.payload.comment.body.match(/#([a-zA-Z0-9_-]+)/g)[0].replace('#','');
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: [label]
});