GithubHelp home page GithubHelp logo

bot's Introduction

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]
    condition: 'payload.issue.number === 1'
    config:
      label: needs-reply
      exclude-labeler: true

The 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. You can also have a condition expression, the result of which determines if the task is run for a particular event payload.

Tasks

  • add-comment: Add a comment to an issue, optionally closing and/or locking the issue
    • comment (string): the comment text
    • close (boolean): if true, close the issue
    • lock (boolean): if true, lock the issue
  • add-contributors: Open a PR to modify README.md when a new contributor appears in a base branch
    • base (string): the base branch
    • file (string): the file to edit (usually README.md)
    • commit-message (string): the lodash template for the commit message; properties: base, file
    • exclude-patterns (string array): the patterns for excluding contributors, defaults to excluding users whose usernames end in [bot]
  • add-label: Add a label to an issue
    • label (string): the label to add
  • add-platform-labels: Parse issue bodies and add labels to issues that have keywords under a Platform header
  • remove-label: Remove a label from an issue
    • label (string): the label to remove
    • exclude-labeler (boolean): if true, the label won't be removed if the event actor is the user that added the label
  • assign-to-project: Assign an issue or pull request to a project
    • columns (object)
      • issue (number): the project column ID to put issues in
      • pr (number): the project column ID to put pull requests in
      • draft-pr (number): the project column ID to put draft PRs in

Condition Context

There are a variety of variables and functions available in condition expressions.

  • payload: the entire event payload
  • config: the task configuration
  • getTeamMembers(teamSlug: string) => Promise<string[]>: get the usernames of an organization team by slug

bot's People

Contributors

dependabot[bot] avatar elylucas avatar imhoffd avatar jcesarmobile avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bot's Issues

Feature List

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.