← Back to issue list

fix: prevent typecheck_with_ty workflow from failing on external PRs

View original Github issue

Metadata

Project
charmcraft
Number
#2662
Type
pull request
State
merged
Author
Copilot
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #2662 (commit ca1d431f) split the typecheck_with_ty workflow into a 'Run ty' step and a 'Report as a comment' step with continue-on-error, so fork PRs no longer fail CI on read-only token addComment errors.

Resolution: closed resolved

Reason: The PR was approved by 3 reviewers and merged into main as ca1d431f, with all CI checks passing (including typecheck-with-ty). It explicitly declares 'Fixes #2619', closing that issue where the ty workflow failed because the token lacked addComment permission on external PRs.

Evaluated by: mr-cal-bot

No scores available.

Issue body

## Summary The `typecheck_with_ty` workflow was failing for PRs from external contributors (forks) because `gh pr comment` requires write access to the repository. For fork PRs, the `github.token` only has read-only permissions, resulting in: ``` GraphQL: Resource not accessible by integration (addComment) ``` ## Changes Split the "Run ty and report as a comment" step into two separate steps: 1. **"Run ty"** — runs the type check and writes the output to a file 2. **"Report as a comment"** — posts the comment to the PR, with `continue-on-error: true` Since posting the PR comment is purely informational (the script itself says "does not require action"), allowing this step to fail without failing the overall job is the correct fix. ## Related Fixes the failure shown in https://github.com/canonical/charmcraft/actions/runs/24743770132/job/72389965791?pr=2640 Fixes #2619

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #2662 (commit ca1d431f) split the typecheck_with_ty workflow into a 'Run ty' step and a 'Report as a comment' step with continue-on-error, so fork PRs no longer fail CI on read-only token addComment errors.
stealth/space-bunny-alpha — closed resolved Merged #2662 (ca1d431f) separated ty checks from PR commenting and allowed informational comment failures to continue, fixing external fork PR CI failures.
qwen/qwen3.6-35b-a3b — — Merged a fix for the typecheck_with_ty workflow failing on external PRs. Splits the workflow into two steps, adding continue-on-error to the comment step to bypass read-only token restrictions on fork PRs while preserving type checking.
qwen3.6-35b-a3b-mtp-q6 — — Merged fix for typecheck_with_ty failing on external PRs due to read-only tokens. The workflow now separates type checking from comment reporting, applying continue-on-error to the comment step so permission errors do not fail the job. Resolves #2619.

Update history

No update history recorded yet.

Related work

  • Duplicate Of: canonical/charmcraft#2619 (confidence 90%)

    PR body states 'Fixes #2619'; that issue (ty CI fails with 'Resource not accessible by integration (addComment)') was the symptom addressed by allowing the comment step to fail.

Related issues

Issue Project State Summary Similarity
#2619 ty CI fails for me charmcraft closed External PR CI no longer fails when the ty workflow cannot comment: PR #2662 (commit ca1d431f) made comment reporting non-fatal.
74%
#2370 ci: add experimental workflow using ty for type checking charmcraft merged Merged PR #2370 (commit d06324ff) added an experimental ty type-checking workflow; CI passed and reported ty diagnostics were informational.
73%
#885 style: enable type checking with ty craft-providers merged Merged as commit 28ccfe5, PR #885 enabled ty type checking and fixed resulting errors across 8 files; all CI checks passed.
73%
#27 ci: type check with ty craft-artifacts merged Merged PR #27 as commit 716f05a, adding ty type checking to CI and suppressing intentional type violations; related lint fixes landed in #20.
71%