Skip to content

Post issue-bot results as a PR comment#5715

Merged
ondrejmirtes merged 1 commit into
2.1.xfrom
issue-bot-pr-comment
May 19, 2026
Merged

Post issue-bot results as a PR comment#5715
ondrejmirtes merged 1 commit into
2.1.xfrom
issue-bot-pr-comment

Conversation

@ondrejmirtes
Copy link
Copy Markdown
Member

Summary

  • Posts and maintains a single PR comment with the issue-bot's findings for each PR run, identified across runs by a <!-- phpstan-issue-bot --> marker.
  • At workflow start, if a prior bot comment already exists, replaces its body with a "run in progress, view job" notice. If none exists yet, nothing is posted (we don't know yet whether changes will be reported).
  • At workflow end:
    • Changes detected (exit 2): create or update the comment with the markdown report (same content currently sent to $GITHUB_STEP_SUMMARY).
    • No changes (exit 0): update the existing comment to note no changes; if no comment exists, skip.
  • Uses the default GITHUB_TOKEN (no PHPSTAN_BOT_TOKEN needed). pull-requests: write is granted only to the two new comment-posting jobs (pr-comment-init, pr-comment-finalize) — the workflow default is contents: read. The push-mode flow (commenting on GitHub issues after merge to 2.2.x) is untouched.

Test plan

  • Open a draft PR with no changes affecting issue-bot snippets → no PR comment is posted.
  • Open a draft PR that does change snippet results → a comment with the report appears after the run completes.
  • Push another commit to that PR → pr-comment-init updates the existing comment to "run in progress" within ~10s; final state is replaced when the new run finishes (either the new report, or a "no changes" notice).
  • Confirm the ::notice :: annotation still appears for change-detected PRs.
  • Confirm push events to 2.2.x continue to post per-issue comments via PHPSTAN_BOT_TOKEN (push pathway is byte-identical aside from the new top-level permissions: default).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/issue-bot.yml Fixed
if: github.event_name == 'pull_request'
runs-on: "ubuntu-latest"
permissions:
pull-requests: write
permissions:
pull-requests: write

steps:
permissions:
pull-requests: write

steps:

cat tmp/step-summary.md >> "$GITHUB_STEP_SUMMARY"

job_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

cat tmp/step-summary.md >> "$GITHUB_STEP_SUMMARY"

job_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

cat tmp/step-summary.md >> "$GITHUB_STEP_SUMMARY"

job_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if: github.event_name == 'pull_request' && needs.evaluate.result == 'success'
runs-on: "ubuntu-latest"
permissions:
pull-requests: write

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
@ondrejmirtes ondrejmirtes force-pushed the issue-bot-pr-comment branch from 05de41f to 12a0fac Compare May 19, 2026 15:59
@ondrejmirtes ondrejmirtes merged commit 4ebd68c into 2.1.x May 19, 2026
716 of 725 checks passed
@ondrejmirtes ondrejmirtes deleted the issue-bot-pr-comment branch May 19, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants