Skip to content

ci: report the coverage of a pull request as well - #550

Merged
k1LoW merged 1 commit into
mainfrom
octocov-report-from-every-run
Sep 8, 2026
Merged

k1LoW merged 1 commit into
mainfrom
octocov-report-from-every-run

Conversation

@k1LoW

@k1LoW k1LoW commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Problem

report.if: is_default_branch in .octocov.yml means a pull request measures its coverage, comments it, and then throws the report away. Nothing is stored, so the coverage of a pull request cannot be looked at once the run is over.

The condition had a reason. The artifact datastore held one report per key, so a run on any ref other than main stored under the same default artifact name and overwrote the report that diff.datastores: compares against — the next pull request would then be diffed against another pull request rather than against main.

k1LoW/octocov#720, released in v0.77.0, derives the artifact name from the ref: a pull request stores under default@refs_pull_N, a branch under default@refs_heads_<name>, and the default branch keeps the bare default that diff.datastores: reads. The overwrite the condition guarded against can no longer happen, and #721 dropped the same line from the config octocov generates for a new repository.

Change

Drop the line from .octocov.yml. Every build run stores its report from now on, while the comparison shown in the pull request comment is unchanged.

Notes

.octocov-full.yml deliberately keeps the condition. integration.yml runs it on pull_request_target, where GITHUB_REF names the base branch rather than a pull request ref. octocov falls back to resolving the number from the head branch of an open pull request of the same repository, so for a pull request from a fork — which is the case the integration-test label exists to serve — the number stays unresolved, the ref key comes out empty, and the report would be stored under the bare octocov-report that the badge and the comparison read. Keeping the condition there leaves that alone; storing the full-test coverage of a pull request would need octocov to key a pull_request_target run by its ref first.

.github/workflows/ci.yml is untouched. octocov-action's version: input defaults to latest, so v0.77.0 is already in use and the pinned action SHA does not hold octocov back. build invokes octocov once, so a run cannot store twice — which is the case octocov's own repository has to gate on the event name, since storing twice within one run makes octocov delete the artifact it wrote first, and that delete needs the actions: write a fork's token does not have.

octocov v0.77.0 stores the report of a ref under a key of its own, so a
run that is not on the default branch no longer overwrites the report
diff.datastores: compares against. report.if: is_default_branch was what
kept those runs from writing, and with it gone the coverage of a pull
request is stored under default@refs_pull_N and stays readable
afterwards. The comparison the comment shows is unchanged, since it
still reads the report of the default branch.

.octocov-full.yml keeps the condition. integration.yml runs it on
pull_request_target, where GITHUB_REF names the base branch, and octocov
resolves the pull request number of such a run through the head branch
of an open pull request of the same repository. A fork's pull request
therefore leaves the ref key empty and would store over the report the
badge and the comparison read.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (ce87951) #550 (cb874b3) +/-
Coverage 34.8% 34.8% 0.0%
Code to Test Ratio 1:0.9 1:0.9 0.0
Test Execution Time 11s 12s +1s
Details
  |                     | main (ce87951) | #550 (cb874b3) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          34.8% |          34.8% | 0.0% |
  |   Files             |             32 |             32 |    0 |
  |   Lines             |           3467 |           3467 |    0 |
  |   Covered           |           1207 |           1207 |    0 |
  | Code to Test Ratio  |          1:0.9 |          1:0.9 |  0.0 |
  |   Code              |           7118 |           7118 |    0 |
  |   Test              |           6969 |           6969 |    0 |
- | Test Execution Time |            11s |            12s |  +1s |

Reported by octocov

@k1LoW k1LoW self-assigned this Sep 8, 2026
@k1LoW
k1LoW marked this pull request as ready for review September 8, 2026 09:37
@k1LoW
k1LoW merged commit 61880c7 into main Sep 8, 2026
1 check passed
@k1LoW
k1LoW deleted the octocov-report-from-every-run branch September 8, 2026 09:37
@github-actions github-actions Bot mentioned this pull request Sep 8, 2026
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

⌂ 换网址