name: Generate README examples

on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: "Set up JDK 11"
        uses: actions/setup-java@v1
        with:
          java-version: 11
      - name: Generate readme
        run: ./gradlew :readme-examples:build
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        with:
          branch: re-generate-README
          title: Re-Generate README examples
          commit-message: generate README examples
          body: Looks like someone forgot to run gr build or did not commit the changes
          delete-branch: true

