/pr-comment-action

Adds comments to PRs and Removes Duplicates

Primary LanguagePythonApache License 2.0Apache-2.0

PR Comment - Create & Edit

Overview

This is a pipeline action to add comments to pull requests and allows for editing previous comments to help keep PRs tidy!

This is useful during for e.g. testing to leave summaries about the latest results in a visble location without adding 1 comment per run.

Features

  • Comment Editing - ability to edit a previous comment with the latest comment to minimise the number of comments on a PR
  • Comment File - output test results into a txt file that can be converted into a markdown comment

Usage

Inputs

Input Required Example Description
comment true "Tests are passing" Your comment!
comment_path false '/tmp/test_results.txt' Global path to a text file which will also be added to the comment
comment_id false 'test_group_a' The id used to determine if a comment should be created or edited

Comment Only

jobs:
  test-code:
    runs-on: ubuntu-latest
    steps:
      - name: ๐Ÿงช Run Tests
        run: echo "SOME TEST"

      - name: ๐Ÿ’ฌ PR Comment
        uses: spicyparrot/pr-comment-action@v1.0.0
        with:
          comment: "๐ŸŽ‰ 100 tests ran successfully!"

Github comment comment_only

With Comment File

jobs:
  test-code:
    runs-on: ubuntu-latest
    steps:
      - name: ๐Ÿงช Run Tests
        run: echo "SOME TEST"

      - name: ๐Ÿ’Œ Comment File
        id: comment_file
        run: |
          COMMENT_PATH=$(pwd)/temp_output.txt
          echo "| Test Case | Result " > $COMMENT_PATH
          echo "| ----------- | ----------- |" >> $COMMENT_PATH
          echo "| ๐Ÿฆœ     |   ๐ŸŒถ๏ธ   |" >> $COMMENT_PATH
          echo "file_path=${COMMENT_PATH}" >> $GITHUB_OUTPUT

      - name: ๐Ÿ’ฌ PR Comment
        uses: spicyparrot/pr-comment-action@v1.0.0
        with:
          comment: "๐Ÿฅผ Test Results"
          comment_path: ${{ steps.comment_file.outputs.file_path }}

Github comment comment_with_file