Skip to content

grant pull-requests: write to PR quality checks workflow#3719

Merged
thewatermethod merged 4 commits into
mainfrom
mb/permissions-change-pr-quality-checks-workflow
Jun 23, 2026
Merged

grant pull-requests: write to PR quality checks workflow#3719
thewatermethod merged 4 commits into
mainfrom
mb/permissions-change-pr-quality-checks-workflow

Conversation

@thewatermethod

@thewatermethod thewatermethod commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Description of change

Fixes the pr-quality-checks workflow so both diff_size_check and review_count_check actually post their advisory comments. They had been silently 403'ing with Resource not accessible by integration and the try/catch swallowed the failure, so the workflow reported success while no comment was ever posted.

Root cause: PR conversation comments are governed by the pull-requests permission scope, not issues — even when created via POST /repos/{owner}/{repo}/issues/{number}/comments. The workflow had pull-requests: read. (#3688 had upgraded issues: write, which is the wrong scope.)

Changes:

  • Grant pull-requests: write (load-bearing fix).
  • Add non-leaky diagnostics: a core.info preamble (event, action, repo, PR#, base ref, cross-repo flag) and an enriched catch that logs e.status and e.request.url. No tokens, secrets, headers, or response bodies are logged.
  • Revert on: pull_request_targeton: pull_request (reverting [TTAHUB-5460] Update quality_check workflows to use correct permissions #3708). With the real bug now understood as a permission scope issue, the pull_request_target trade-off has no practical benefit for this repo's all-internal-branch contribution model, and pull_request lets the workflow be exercised pre-merge on the PR branch.

How to test

Already validated on this PR:

Jira Issue(s)

Checklists

Every PR

  • Linked Jira issue
  • JIRA issue status updated
  • Code is meaningfully tested
  • Meets accessibility standards (WCAG 2.1 Levels A, AA)
  • API Documentation updated
  • Boundary diagram updated
  • Logical Data Model updated
  • Architectural Decision Records written for major infrastructure decisions
  • UI review complete
  • QA review complete

Before merge to main

  • OHS demo complete
  • Ready to create production PR

After merge/deploy

  • Update JIRA ticket status

thewatermethod and others added 3 commits June 23, 2026 09:39
PR conversation comments via rest.issues.createComment require the
pull-requests permission scope, not issues — despite the API path being
/issues/{number}/comments. The token previously had pull-requests: read,
so both diff_size_check and review_count_check failed with
'Resource not accessible by integration' and the try/catch swallowed
the error (workflow reported success, but no advisory comment appeared).

The earlier #3688 fix added issues: write, which is the wrong scope for
PR comments and therefore had no effect.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a small core.info preamble (event, action, repo, PR#, base ref,
cross-repo flag) before any API call, and expands the catch to surface
e.status and e.request.url so future failures show *which* endpoint
returned what HTTP status — without ever logging the token, secrets,
request headers, or response bodies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

Diff size: 20 lines — within the 500-line guideline.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review count: 2 human approvals — tommaroh, AdamAdHocTeam.

@thewatermethod thewatermethod changed the title fix(ci): grant pull-requests: write to PR quality checks workflow grant pull-requests: write to PR quality checks workflow Jun 23, 2026
@thewatermethod thewatermethod marked this pull request as ready for review June 23, 2026 18:22
@thewatermethod thewatermethod removed the request for review from tommaroh June 23, 2026 18:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the PR Quality Checks GitHub Actions workflow to reliably post (or update) advisory PR conversation comments for diff size and required review count, by correcting the workflow token permission scope and improving failure diagnostics.

Changes:

  • Switch trigger back to pull_request and update job if: conditions accordingly.
  • Grant pull-requests: write permission (required for posting PR conversation comments).
  • Add lightweight core.info context logging and enrich catch logs with HTTP status + request URL.

Impact assessment (benefit/risk):

  • Benefit: High — restores intended automated PR feedback and adds actionable diagnostics for failures.
  • Risk: Medium — workflow trigger/permission changes affect CI behavior and can regress review-comment updating if event gating is incorrect.

Comment thread .github/workflows/pr-quality-checks.yml
@thewatermethod thewatermethod added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit ef00494 Jun 23, 2026
21 of 24 checks passed
@thewatermethod thewatermethod deleted the mb/permissions-change-pr-quality-checks-workflow branch June 23, 2026 19:47
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.

5 participants