Skip to content

Fix invalid PR workflow permissions and guidance - #403

Merged
twisti-dev merged 1 commit into
masterfrom
fix/close-invalid-pr-permissions
Jul 29, 2026
Merged

Fix invalid PR workflow permissions and guidance#403
twisti-dev merged 1 commit into
masterfrom
fix/close-invalid-pr-permissions

Conversation

@twisti-dev

Copy link
Copy Markdown
Collaborator

Summary

  • run the invalid-PR policy on pull_request_target so the declared write permissions remain available for pull requests from forks
  • avoid checking out or executing contributor-controlled code
  • only inspect the triggering pull request during event runs, while retaining repository-wide scanning for manual dispatches
  • add a clearer closure comment explaining why contributors should not open pull requests from their fork's default branch and how to correct it

Root cause

Run 30388087313, job 90372357551, received a read-only GITHUB_TOKEN (Issues: read, PullRequests: read). The workflow then called gh pr close --comment, which requires permission to add a comment and update the pull request state, causing Resource not accessible by integration (addComment).

Verification

The workflow no longer checks out pull request contents and passes event-derived values through environment variables rather than interpolating them directly into shell code.

@mergify
mergify Bot requested a review from a team July 29, 2026 13:19
@twisti-dev
twisti-dev marked this pull request as ready for review July 29, 2026 13:19
Copilot AI review requested due to automatic review settings July 29, 2026 13:19

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@twisti-dev
twisti-dev merged commit 61de8ae into master Jul 29, 2026
5 checks passed
@twisti-dev
twisti-dev deleted the fix/close-invalid-pr-permissions branch July 29, 2026 13:20
@github-project-automation github-project-automation Bot moved this from Backlog to Done in community-server-docs Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants