WordPress Playground documentation #2764
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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_issues: | |
if: ${{ !github.event.issue.pull_request }} | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- uses: actions/[email protected] | |
with: | |
script: console.log(context) | |
- uses: actions/[email protected] | |
if: contains(github.event.comment.body, '/review') # check the comment if it contains the keywords | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["[Status] Review"] | |
}) | |
- uses: actions/[email protected] | |
if: contains(github.event.issue.labels.*.name, '[Status] In progress') && contains(github.event.comment.body, '/review') | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ["[Status] In progress"] | |
}) | |
- uses: actions/[email protected] | |
if: contains(github.event.issue.labels.*.name, '[Status] To do') && contains(github.event.comment.body, '/review') | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ["[Status] To do"] | |
}) | |
- uses: actions/[email protected] | |
if: contains(github.event.issue.labels.*.name, '[Status] Done') && contains(github.event.comment.body, '/review') | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ["[Status] Done"] | |
}) | |
# rather use this one: https://github.com/marketplace/actions/contributor-takes-action | |
assign_issue: | |
if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/assign') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Assign the comment author | |
uses: takanome-dev/[email protected] | |
with: | |
github_token: '${{ secrets.GITHUB_TOKEN }}' | |
trigger: '/assign' # you can change the default trigger to something else | |
required_label: '' # if present, the issue must have this label to be assigned | |
assigned_label: 'self-assigned' | |
assigned_comment: "Hey @{{ comment.user.login }}, thanks for your interest in this issue! 🍪🍪🍪<br>If you have any questions, do not hesitate to ask them in our <a href='https://wordpress.slack.com/archives/C02RP4WU5'>#docs</a> Slack channel.<br>Enjoy and happy contributing ❤️" | |
already_assigned_comment: "Hey @{{ comment.user.login }}, this issue is already assigned to @{{ assignee.login }}.<br>A maintainer can also add you to the list of assignees or swap you with the current assignee. Or you can take a look at other unassigned issues we have.<br>" | |
pin_label: '' | |
days_until_unassign: 0 | |