name: Update RULES.md

on: [push, pull_request]

jobs:
  build:

    strategy:
      matrix:
        os: [ubuntu-latest]
        rust: [stable]

    runs-on: ${{ matrix.os }}

    steps:
    - name: Setup Rust
      uses: hecrj/setup-rust-action@v1
      with:
        rust-version: ${{ matrix.rust }}
    - name: Checkout
      uses: actions/checkout@v1
    - name: Run mdgen
      run: cargo run --bin mdgen > RULES.md
    - name: Commit
      uses: EndBug/add-and-commit@v2.1.0
      with:
        author_name: dalance
        author_email: dalance@gmail.com
        message: "Update RULES.md"
        path: "./"
        pattern: "RULES.md"
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
