Skip to content

PR Status Comment

Post or update a single sticky PR comment summarizing your CI job statuses as a table — one bot comment per PR that updates in place across pushes, instead of a new comment piling up every run. This action builds the table (and any extra Markdown sections you pass in) from your job results; posting itself is delegated to marocchino/sticky-pull-request-comment.

  • The calling job needs permissions: pull-requests: write (not issues: write — the underlying action’s permission manifest requires pull-requests: write specifically, and without it the comment step fails with Resource not accessible by integration, even though the REST endpoint it hits is nominally issues/comments).
  • jobs (required): JSON object mapping a display label to a status, e.g. {"🧾 Conventional Commits": "success", "🏗️ Build": "failure"}. Use needs.<job>.result for each entry — GitHub Actions exposes this natively, no custom outputs.status plumbing needed in the upstream jobs.
  • extra-markdown: Additional Markdown appended after the status table (default: none). Use this for repo-specific sections (coverage, mutation testing, benchmarks, …) instead of reimplementing the table logic per repo.
  • comment-header: Header used to identify the sticky comment to update (default: PR Validation). Only relevant if you post more than one sticky comment on the same PR.
  • github-token: Token used to create/update the comment (default: github.token).
pr-comment:
  runs-on: ubuntu-latest
  needs: [conventional-commits, build, test]
  if: always()
  steps:
    - uses: helpers4/action/pr-status-comment@v1
      with:
        jobs: |
          {
            "🧾 Conventional Commits": "${{ needs.conventional-commits.result }}",
            "🏗️ Build": "${{ needs.build.result }}",
            "🧪 Tests": "${{ needs.test.result }}"
          }
- uses: helpers4/action/pr-status-comment@v1
  with:
    jobs: |
      {
        "🏗️ Build": "${{ needs.build.result }}",
        "🧪 Tests": "${{ needs.test.result }}"
      }
    extra-markdown: |
      ### 📊 Code Coverage

      > 🎯 **Overall Coverage: ${{ needs.test.outputs.coverage }}%**