name: Create Pull Request Example Command
on:
  repository_dispatch:
    types: [cpr-example-command]
jobs:
  createPullRequest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Create report file
        run: date +%s > report.txt
      - name: Create Pull Request
        id: cpr
        uses: ./
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: Add report file
          committer: Peter Evans <peter-evans@users.noreply.github.com>
          title: '[Example] Add report file'
          body: |
            New report
            - Contains *today's* date
            - Auto-generated by [create-pull-request][1]

            [1]: https://github.com/peter-evans/create-pull-request
          labels: report, automated pr
          assignees: peter-evans
          reviewers: peter-evans
          milestone: 1
          project: Example Project
          project-column: To do
          branch: example-patches
      - name: Check outputs
        run: |
          echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
          echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}"
      - name: Add reaction
        uses: peter-evans/create-or-update-comment@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
          comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
          reaction-type: hooray
