Skip to content

live-codes/pr-comment-from-artifact

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Post PR Comment from Artifact

This GitHub Action allows you to post a pull request comment from an artifact.

The artifact is downloaded, extracted and the first file in it is used for the comment. The file name is used as the pull request number (excluding the file extension), while the content of the file is used as the comment body.

"Upsert" mode is used for multiple comments to the same pull request (the comment is updated if it already exists).

Typically, this action is used in conjunction with a workflow that creates an artifact (like live-codes/preview-in-livecodes), and is triggered by a successful workflow run (see usage below).

Inputs

  • GITHUB_TOKEN: Github token of the repository - (default: ${{ github.token }} [automatically created by Github])
  • artifact: Name of the artifact - (default: "pr")

Outputs

  • id: ID of the comment
  • body: Body of the comment
  • html_url: HTML URL of the comment

Usage

name: Comment on pull request

on:
  workflow_run:
    workflows: ["create-artifact"] # the workflow that created the artifact
    types:
      - completed

jobs:
  upload:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    if: >
      github.event.workflow_run.event == 'pull_request' &&
      github.event.workflow_run.conclusion == 'success'

    steps:
      - name: Post comment
        uses: live-codes/pr-comment-from-artifact@v1
        with:
          GITHUB_TOKEN: ${{ github.token }}

Credits

Based on:

License

MIT License