An action to add or update an existing comment anchored in a PR for test results, status messages, etc.
Find a file
2024-03-28 07:46:16 -05:00
.github docs: add working/updated example 2024-03-28 07:46:16 -05:00
action.yml revert 803b90604e 2024-03-02 21:19:24 +00:00
COPYING add AGPL COPYING/LICENSE files 2024-03-28 07:41:11 -05:00
LICENSE add AGPL COPYING/LICENSE files 2024-03-28 07:41:11 -05:00

action-pr-comment

An action to add or update an existing comment anchored in a PR for test results, status messages, etc.

Example

name: Some Workflow

on:
  pull_request:

jobs:
  some-workflow:
    name: Send PR Comment
    if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') }}
    runs-on: ubuntu-act-latest
    steps:

      - name: Validate
        id: validate
        shell: bash
        run: |
          some-validation-step arg1 arg2 ... 2>&1 | tee validate.json
          export SOME_ENV_VAR=$(cat validate.json | sed -z 's/\n/\\n/g')
          echo "SOME_ENV_VAR=\"$SOME_ENV_VAR\"" >> $GITHUB_OUTPUT

      - name: Post/Update PR Comment
        if: always()
        uses: https://git.auengun.net/homelab/action-pr-comment@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          comment: |
            #### Validation 🤖 \`${{ steps.validate.outcome }}\`
            <details open>
            <summary>Shell Output</summary>

            \`\`\`json\n
            ${{ fromJSON(steps.validate.outputs.SOME_ENV_VAR) }}
            \`\`\`

            </details>

            *Commit: ${{ github.sha }}*