name: eufy_create_mr_and_build_image

on:
  workflow_dispatch:
  repository_dispatch:
    types: [create_mr_and_build_image]
#  schedule:
#    - cron: "0 6,18 * * *"
jobs:
  create_mr_and_build_image:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - run: cd eufy-ha-mqtt-bridge && ./version-updater.sh

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v5
        with:
          title: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }}
          commit-message: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }}
          committer: Max Winterstein <MaxWinterstein@users.noreply.github.com>
          author: Max Winterstein <MaxWinterstein@users.noreply.github.com>
          assignees: MaxWinterstein
          body: |
            Update report
            - Update related files of eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} [Changelog][1]
            - Build docker image, check [DockerHub][2]

            [1]: https://github.com/matijse/eufy-ha-mqtt-bridge/releases
            [2]: https://hub.docker.com/r/maxwinterstein/
        if: ${{ env.CONTINUE }}
