Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ The action handles everything else automatically: gzip/base64 encoding, resolvin

## Inputs

| Input | Required | Description |
|-------|----------|-------------|
| `file` | Yes | Path to the Cobertura XML coverage report |
| `language` | Yes | Linguist language name (e.g. `Java`, `Go`, `Python`) |
| `label` | Yes | Label for the report (e.g. `code-coverage/jacoco`) |
| `token` | No | GitHub token (defaults to `github.token`) |
| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `file` | Yes | | Path to the Cobertura XML coverage report |
| `language` | Yes | | Linguist language name (e.g. `Java`, `Go`, `Python`) |
| `label` | Yes | | Label for the report (e.g. `code-coverage/jacoco`) |
| `fail-on-error` | No | `true` | Whether to fail the workflow step if the upload fails |
| `token` | No | `github.token` | GitHub token with `code-quality:write` permission |

## Permissions

Expand All @@ -35,6 +36,23 @@ permissions:

For push-only workflows where the action looks up PR numbers via `gh pr list`, also add `pull-requests: read`.

## Error handling

By default, the action fails the workflow step (exits with code 1) when the upload is unsuccessful. This ensures you notice when coverage data is not being stored.

If coverage upload is best-effort in your workflow and you don't want a transient API failure to block CI, set `fail-on-error: false`:

```yaml
- uses: actions/upload-code-coverage@v1
with:
file: cobertura.xml
language: Java
label: code-coverage/jacoco
fail-on-error: false
```

When `fail-on-error` is `false`, upload errors are still surfaced as `::error::` annotations in the workflow log, but the step exits 0.

## Event handling

The action auto-detects the event type and resolves the correct values:
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
label:
description: 'Label for the coverage report (e.g. "code-coverage/jacoco")'
required: true
fail-on-error:
description: 'Whether to fail the workflow step if the upload fails (set to false to treat upload errors as warnings)'
required: false
default: 'true'
token:
description: 'GitHub token with code-quality:write permission'
required: false
Expand All @@ -26,6 +30,7 @@ runs:
INPUT_FILE: ${{ inputs.file }}
INPUT_LANGUAGE: ${{ inputs.language }}
INPUT_LABEL: ${{ inputs.label }}
FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_API_URL: ${{ github.api_url }}
Expand Down
Loading
Loading