Add use_python input to action.yml and update related files

* **action.yml**
  - Add a new input `use_python` to specify whether to use Python to run `codecov-cli`
  - Update the `runs` section to include a step for installing `codecov-cli` using Python when `use_python` is set to true

* **README.md**
  - Update the usage section to include the new `use_python` option for running `codecov-cli`

* **CHANGELOG.md**
  - Add an entry to mention the addition of the `use_python` option for running `codecov-cli`
This commit is contained in:
Zxilly 2024-11-19 22:53:50 +08:00
parent 21f471b090
commit 604c83ecb5
3 changed files with 18 additions and 0 deletions

View file

@ -290,3 +290,7 @@ for the full list.
- #166 Bump requestretry from 4.1.1 to 4.1.2
- #169 Bump typescript from 4.0.5 to 4.1.2
- #178 Bump @types/jest from 26.0.15 to 26.0.19
## 5.0.3
### Features
- Added an option to use Python to run `codecov-cli` in `action.yml` by introducing a new input `use_python`.

View file

@ -68,6 +68,7 @@ steps:
name: codecov-umbrella # optional
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
use_python: true # optional (default = false)
```
The Codecov token can also be passed in via environment variables:
@ -82,6 +83,7 @@ steps:
flags: unittests # optional
name: codecov-umbrella # optional
verbose: true # optional (default = false)
use_python: true # optional (default = false)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
```
@ -138,6 +140,7 @@ Codecov's Action supports inputs from the user. These inputs, along with their d
| `verbose` | Specify whether the Codecov output should be verbose | Optional
| `version` | Specify which version of the Codecov CLI should be used. Defaults to `latest` | Optional
| `working-directory` | Directory in which to execute codecov.sh | Optional
| `use_python` | Use Python to run codecov-cli instead of binary | Optional
### Example `workflow.yml` with Codecov Action
@ -175,6 +178,7 @@ jobs:
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
use_python: true
```
## Contributing

View file

@ -146,6 +146,10 @@ inputs:
working-directory:
description: 'Directory in which to execute codecov.sh'
required: false
use_python:
description: 'Use Python to run codecov-cli instead of binary'
required: false
default: 'false'
branding:
color: 'red'
@ -215,6 +219,12 @@ runs:
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
- name: Install codecov-cli using Python
if: ${{ inputs.use_python == 'true' }}
shell: bash
run: |
pip install codecov-cli
- name: Upload coverage to Codecov
run: ${GITHUB_ACTION_PATH}/dist/codecov.sh
shell: bash