Bot
The bot for Ionic and Capacitor repos, implemented using GitHub Actions.
Config
There are two steps to setting up the configuration for this bot.
Workflow File
Add a GitHub Actions workflow file for the bot (usually .github/workflows/bot.yml).
name: Bot
on:
push:
issues:
types: [opened, edited]
issue_comment:
types: [created]
jobs:
bot:
name: ${{ github.event_name }}/${{ github.event.action }}
runs-on: ubuntu-latest
steps:
- uses: ionic-team/bot@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}Config File
Though this bot is one GitHub Action, it does many things. Because of this, a separate configuration file is needed specifically for the bot (.github/bot.yml):
tasks:
- name: remove-label
on:
issue_comment:
types: [created]
config:
label: needs-reply
exclude-labeler: trueThe tasks key is an array of tasks, the event that triggers them, and their configuration. Notice how the on block is copied from the workflow file to specify exactly which events triggers which tasks.
Tasks
add-comment: Add a comment to an issuecomment(string): the comment textclose(boolean): iftrue, close the issuelock(boolean): iftrue, lock the issue
add-comment-for-label: Make a comment when a label is added, optionally closing and/or locking the issuename(string): the name of the labelcomment(string): the comment text. ifundefined, the comment is not addedclose(boolean): iftrue, close the issuelock(boolean): iftrue, lock the issue
add-contributors: Open a PR to modifyREADME.mdwhen a new contributor appears in a base branchbase(string): the base branchfile(string): the file to edit (usuallyREADME.md)commit-message(string): the lodash template for the commit message; properties:base,fileexclude-pattern(string): the pattern for excluding contributors, defaults to excluding users whose usernames end in[bot]
add-label: Add a label to an issuelabel(string): the label to add
add-platform-labels: Parse issue bodies and add labels to issues that have keywords under aPlatformheaderremove-label: Remove a label from an issuelabel(string): the label to removeexclude-labeler(boolean): iftrue, the label won't be removed if the event actor is the user that added the label