Skip to content

ci: post validation comment via workflow_run to fix fork PRs#31

Merged
anistark merged 1 commit into
mainfrom
fix/pr-comment-fork-permissions
Jun 15, 2026
Merged

ci: post validation comment via workflow_run to fix fork PRs#31
anistark merged 1 commit into
mainfrom
fix/pr-comment-fork-permissions

Conversation

@anistark

Copy link
Copy Markdown
Contributor

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.

Summary

Type of change

  • Add a plugin → please use the add-plugin template instead
  • Update a plugin → please use the update-plugin template instead
  • Remove a plugin → please use the remove-plugin template instead
  • Marketplace / registry change (schema, validation, plugins/ tooling)
  • Site / docs change (landing page, README, content)
  • CI / workflow / repo tooling
  • Bug fix
  • Other

Checklist

Uncheck any item that does not apply or has not been completed.

  • I have read and understood the contributing guidelines
  • Changes are scoped and focused on a single concern
  • Tested locally where applicable
  • Updated relevant docs (README, site content, etc.) if behavior changed
  • Did not hand-edit marketplace.json (it is generated)

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.
@anistark anistark merged commit 91e2e3e into main Jun 15, 2026
@anistark anistark deleted the fix/pr-comment-fork-permissions branch June 15, 2026 18:39
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.

1 participant