ci: post validation comment via workflow_run to fix fork PRs#31
Merged
Conversation
The "Validate plugin submission" workflow runs its checks and posts the result comment from the same job. On pull requests from forks, GitHub forces `GITHUB_TOKEN` to read-only regardless of the workflow's `permissions:` block, so `issues.createComment` returned 403 "Resource not accessible by integration" and the job failed — even though every validation check passed. This broke the run on every external contributor's PR (e.g. #29, #30). Split comment posting out of the validation job: - `validate-plugin.yml` now runs read-only (`contents: read`). Instead of commenting, it renders the comment body and PR number to a `pr-comment` artifact. Step outputs are passed via env vars rather than interpolated into the script, and the literal `\n` sequences the shell steps emit are converted to real newlines. - `comment-on-pr.yml` is a new `workflow_run` workflow that fires when validation completes. It runs in the base-repo context with a writable token, downloads the artifact, and creates or updates the comment. Because it only reads an artifact and never checks out or runs PR code, granting it write permissions is safe. Note: `workflow_run` only takes effect from the default branch, so this fix activates after merge to `main`; the validation workflow must re-run on a PR afterward to produce the comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "Validate plugin submission" workflow runs its checks and posts the result comment from the same job. On pull requests from forks, GitHub forces
GITHUB_TOKENto read-only regardless of the workflow'spermissions:block, soissues.createCommentreturned 403 "Resource not accessible by integration" and the job failed — even though every validation check passed. This broke the run on every external contributor's PR (e.g. #29, #30).Split comment posting out of the validation job:
validate-plugin.ymlnow runs read-only (contents: read). Instead of commenting, it renders the comment body and PR number to apr-commentartifact. Step outputs are passed via env vars rather than interpolated into the script, and the literal\nsequences the shell steps emit are converted to real newlines.comment-on-pr.ymlis a newworkflow_runworkflow that fires when validation completes. It runs in the base-repo context with a writable token, downloads the artifact, and creates or updates the comment. Because it only reads an artifact and never checks out or runs PR code, granting it write permissions is safe.Note:
workflow_runonly takes effect from the default branch, so this fix activates after merge tomain; the validation workflow must re-run on a PR afterward to produce the comment.Summary
Type of change
plugins/tooling)Checklist
Uncheck any item that does not apply or has not been completed.
marketplace.json(it is generated)