Skip to content

[DevHub] Outdated external link in Plugin Handbook - "Using Subversion" page #4888

[DevHub] Outdated external link in Plugin Handbook - "Using Subversion" page

[DevHub] Outdated external link in Plugin Handbook - "Using Subversion" page #4888

# https://github.com/marketplace/actions/github-script
# https://github.com/orgs/community/discussions/25389#discussioncomment-3247738
name: Label and assign issues when commented
on:
issue_comment:
types: [created, edited]
jobs:
label_assign_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/github-script@v7.0.1
with:
script: console.log(context)
- uses: actions/github-script@v7.0.1
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/review') }}
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
// Get latest issue state (labels + assignees)
const { data: issue } = await github.rest.issues.get({
owner,
repo,
issue_number,
});
const labels = issue.labels.map(l => l.name);
// Add [Status] Review if missing
if (!labels.includes('[Status] Review')) {
await github.rest.issues.addLabels({
owner,
repo,
issue_number,
labels: ['[Status] Review'],
});
}
// Remove [Status] In progress if present
if (labels.includes('[Status] In progress')) {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: '[Status] In progress',
});
}
// Unassign all assignees
const assignees = (issue.assignees || []).map(a => a.login);
if (assignees.length > 0) {
await github.rest.issues.removeAssignees({
owner,
repo,
issue_number,
assignees,
});
}
assign_issue_to_commenter:
if: ${{ !github.event.issue.pull_request && contains(github.event.comment.body, '/assign') }}
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const commenter = context.payload.comment.user.login;
// Assign the issue to the commenter
await github.rest.issues.addAssignees({
owner,
repo,
issue_number,
assignees: [commenter],
});