An action to add or update an existing comment anchored in a PR for test results, status messages, etc.
Find a file
2025-09-16 16:10:58 +00:00
.forgejo/workflows chore(deps): update https://git.auengun.net/actions/forgejo-release action to v2.7.3 2025-09-16 12:30:37 +00:00
LICENSES ci: consistency sweeping patterns of release/tagging/licensing 2025-05-13 11:54:55 -05:00
.gitignore ci: consistency sweeping patterns of release/tagging/licensing 2025-05-13 11:54:55 -05:00
.renovaterc.json5 ci: consistency sweeping patterns of release/tagging/licensing 2025-05-13 11:54:55 -05:00
.version chore(release): 1.3.0 2025-09-05 11:58:06 +00:00
.version.license ci(fix): adding .version file to match exising tag 2025-05-13 12:18:36 -05:00
.versionrc ci(fix): adding .version file to match exising tag 2025-05-13 12:18:36 -05:00
.versionrc.license ci: consistency sweeping patterns of release/tagging/licensing 2025-05-13 11:54:55 -05:00
action.yml chore(deps): update https://github.com/actions/github-script action to v8 2025-09-05 00:34:08 +00:00
Makefile ci: consistency sweeping patterns of release/tagging/licensing 2025-05-13 11:54:55 -05:00
README.md ci: consistency sweeping patterns of release/tagging/licensing 2025-05-13 11:54:55 -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:
  push:
    branches:
      - main
  pull_request:

jobs:
  some-workflow:
    name: Send PR Comment
    runs-on: ubuntu-act-latest
    steps:
      - name: Clone Repo into Workspace
        uses: https://git.auengun.net/homelab/action-common-setup

      - name: "`make test`"
        if: ${{ github.event_name == 'pull_request' && !cancelled() }}
        shell: bash
        run: |
          set +e
          make test 2>&1 | tee make_test.log
          RESULT="$?"
          set -e
          {
            echo "# Automated Forgejo Actions Report"
            echo ""
            echo "\`\`\`shell"
            cat make_test.log
            echo "\`\`\`"
          } 2>&1 >> "${{github.workspace}}/.pr-comment.md"
          echo "Saved to '${{github.workspace}}/.pr-comment.md'"
          exit $RESULT

      # Posts a comment back to the PR that spawned this CI
      # and keeps it in sync whenever there is a change.
      - name: Post/Update PR Comment
        if: ${{ github.event_name == 'pull_request' && !cancelled() }}
        continue-on-error: true
        uses: https://git.auengun.net/homelab/action-pr-comment
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          path: "${{github.workspace}}/.pr-comment.md"