fix(action): add optional support for removed files in changed coverage#286
Open
jeduardoc wants to merge 2 commits intoMadrapps:mainfrom
Open
fix(action): add optional support for removed files in changed coverage#286jeduardoc wants to merge 2 commits intoMadrapps:mainfrom
jeduardoc wants to merge 2 commits intoMadrapps:mainfrom
Conversation
Introduce an opt-in input to ignore files marked as removed by the GitHub compare API when building changed-file coverage data. Keep the default behavior unchanged, add regression tests for both modes, and refresh the generated action artifacts.
Describe the new optional input in the README and keep the existing coverage output description unchanged.
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.
Summary
This PR adds an opt-in way to ignore removed files from changed coverage calculations without changing the current default behavior.
The goal is to address a real integration issue caused by removed files returned by the GitHub compare API while preserving backward compatibility for repositories already relying on the current output semantics.
Background
While investigating a failing downstream workflow that consumes
madrapps/jacoco-report@v1.7.2, we found a scenario where the compare API included files withstatus: removedin the changed file list.Those files do not exist in the JaCoCo XML report, but they still flow through the changed-files processing path. This can distort the changed coverage result used by downstream workflows.
At the same time, changing the existing default behavior globally would be risky because repositories may already depend on the current output contract.
Root Cause
The action builds its changed-file list directly from the GitHub compare API response and, today, does not provide a way to exclude removed files.
When removed files appear in the diff:
What changed
Functional change
A new optional input was added:
ignore-removed-files(default:false)When enabled, the action excludes compare API entries where
status === 'removed'before building the internal changed-file list.Compatibility
This implementation intentionally keeps the current default behavior unchanged:
Tests
Documentation
ignore-removed-filesinput inREADME.mdaction.ymlcoverage-changed-filesoutput description unchangedWhy this approach
This is the narrowest fix with the lowest compatibility risk:
Validation
Executed locally:
npm test -- --runInBand __tests__/action_single.test.ts __tests__/action_multiple.test.ts __tests__/action_aggregate.test.ts __tests__/action_empty_aggregate.test.ts __tests__/action_empty_multiple.test.ts __tests__/action_empty_report.test.tsnpm run buildCommits
c977eeefix(action): add optional support for removed files in changed coverage87f1215docs(readme): document the ignore-removed-files inputReferences
Related issues in this repository:
#71Incorrect value forsteps.jacoco.outputs.coverage-changed-filessteps.jacoco.outputs.coverage-changed-files#71#42Jacoco Ignored files are shown as 0% coverage#170Discrepancy with the Coverage reportAdditional context:
madrapps/jacoco-report@v1.7.2This PR focuses specifically on making removed-file handling available as an explicit compatibility-safe option.