name: "Comment usage instructions on PRs"
description: "Comment usage instructions on PRs"

inputs:
  tag:
    description: "Image tag to pull"
    required: true

runs:
  using: "composite"
  steps:
    - name: Find Comment
      uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v2
      id: fc
      with:
        issue-number: ${{ github.event.pull_request.number }}
        comment-author: "github-actions[bot]"
        body-includes: authentik PR Installation instructions
    - name: Create or update comment
      uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v2
      with:
        comment-id: ${{ steps.fc.outputs.comment-id }}
        issue-number: ${{ github.event.pull_request.number }}
        body: |
          authentik PR Installation instructions

          <details>
            <summary>Instructions for docker-compose</summary>

            Add the following block to your `.env` file:

            ```shell
            AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
            AUTHENTIK_TAG=${{ inputs.tag }}
            AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
            ```

            Afterwards, run the upgrade commands from the latest release notes.
          </details>
          <details>
            <summary>Instructions for Kubernetes</summary>

            Add the following block to your `values.yml` file:

            ```yaml
            authentik:
                outposts:
                    container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
            global:
                image:
                    repository: ghcr.io/goauthentik/dev-server
                    tag: ${{ inputs.tag }}
            ```

            Afterwards, run the upgrade commands from the latest release notes.
          </details>
        edit-mode: replace
