name: PR head from 3rd party action

on:
  workflow_call:
  workflow_dispatch:

jobs:

  test1:
    runs-on: ubuntu-20.04
    steps:
      - name: (PR comment) Get PR branch
        if: ${{ github.event_name == 'issue_comment' }}
        uses: xt0rted/pull-request-comment-branch@v2
        id: comment-branch
      - name: (PR comment) Checkout PR branch
        if: ${{ github.event_name == 'issue_comment' }}
        uses: actions/checkout@v3
        with:
          ref: ${{ steps.comment-branch.outputs.head_sha }}

  test2:
    runs-on: ubuntu-20.04
    steps:
      - name: (PR comment) Get PR branch
        if: ${{ github.event_name == 'issue_comment' }}
        uses: xt0rted/pull-request-comment-branch@v2
        id: comment-branch

      - name: (PR comment) Checkout PR branch
        if: ${{ github.event_name == 'issue_comment' }}
        uses: actions/checkout@v3
        with:
          ref: ${{ steps.comment-branch.outputs.head_ref }}

  test3:
    runs-on: ubuntu-20.04
    steps:
      - name: resolve pr refs
        id: refs
        uses: eficode/resolve-pr-refs@main
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

      - uses: actions/checkout@v4
        with:
          ref: ${{ steps.refs.outputs.head_ref }}
          fetch-depth: 0
      - uses: actions/checkout@v4
        with:
          ref: ${{ steps.refs.outputs.head_sha }}
          fetch-depth: 0
