Unable to specify coverage reports flags per file
Current way to define flags forces them to apply to all files part of a single upload step. Ideally the flags should be per file and not per upload action.
This makes Github Actions definition much harder to manage as we are forced to add extra calls to the upload action, especially as GHA does not have any support for looping.
It would be far more flexible if we could so something like:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./coverage/reports/
files: ./coverage1.xml:unit,./coverage2.xml:e2e,!./cache # <- note the `:flag` after file pattern.
# flags: unit,e2e
Or maybe someone else has another idea?
Not totally sure about the intent... But I'm facing a similar issue. My issue is that with the current codecov action, I'm not able to upload coverage for each packages (flagged): ie: flag-lib1: coverage 90%, flag-lib2: coverage: 81%
I have a nodejs monorepo setup: https://github.com/belgattitude/httpx
.
└── packages
│── assert
└── coverage/clover.xml
│── dsn-parser
└── coverage/clover.xml
│── exception
└── coverage/clover.xml
└── plain-object
└── coverage/clover.xml
- codecov.yml
In my codecov.yml, I've set up the flags for each packages
See here
coverage:
range: 60..100
round: down
precision: 2
flag_management:
default_rules:
carryforward: false
individual_flags:
- name: httpx-exception-unit
paths:
- packages/exception
statuses:
- type: project
target: 90%
threshold: 1%
- name: httpx-dsn-parser-unit
paths:
- packages/dsn-parser
statuses:
- type: project
target: 90%
threshold: 1%
- name: httpx-memo-intl-unit
paths:
- packages/memo-intl
statuses:
- type: project
target: 90%
threshold: 1%
- name: httpx-plain-object-unit
paths:
- packages/plain-object
statuses:
- type: project
target: 90%
threshold: 1%
- name: httpx-assert-unit
paths:
- packages/assert
statuses:
- type: project
target: 90%
threshold: 1%
- name: httpx-json-api-unit
paths:
- packages/json-api
statuses:
- type: project
target: 50%
threshold: 1%
ignore:
- '.yarn/**/*'
- '.husky/**/*'
- 'docs/**/*'
- 'examples/**/*'
- '**/dist/**/*'
github_checks: true
comment:
layout: 'reach, diff, flags, files'
behavior: default
require_changes: false
require_base: yes
require_head: yes
branches: null
show_carryforward_flags: true
I was expecting the codecov action to read paths assicated to the flags... but it actually doesn't.
So to be able to get covergae independently, I have to upload multiple times with each flags.
It would be nice to have a better way to do
PS: I have done it with the cli, but it does not work anymore (complains about missing token..., or rate limits)
Any progress on this please?
One year later and the situation is now worse, codecov complains in the UI about multiple flags being provided despite the fact that they own actions supports multiple ones.
Multiple flags detected. Please ensure one flag per upload.

This was caused https://github.com/codecov/gazebo/pull/3375 which apparently was on purpose but without mentioning exactly why or the fact that multiple flags are still supported by the action. I guess that the action should start failing if multiple flags are passed. A bit of incomplete implementation.