From 604c83ecb5aec5a9dff566cd60533e77251385d0 Mon Sep 17 00:00:00 2001 From: Zxilly <31370133+Zxilly@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:53:50 +0800 Subject: [PATCH 1/2] 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` --- CHANGELOG.md | 4 ++++ README.md | 4 ++++ action.yml | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbc89c8942..e882a458bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/README.md b/README.md index 4c08455d78..b28538d247 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/action.yml b/action.yml index 871231929f..3c0a7708f8 100644 --- a/action.yml +++ b/action.yml @@ -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 From 7af514796092162006f9a40b2d648695dd4b3c74 Mon Sep 17 00:00:00 2001 From: Zxilly <31370133+Zxilly@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:11:44 +0000 Subject: [PATCH 2/2] add env --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 3c0a7708f8..1340784577 100644 --- a/action.yml +++ b/action.yml @@ -266,3 +266,4 @@ runs: CC_VERBOSE: ${{ inputs.verbose }} CC_VERSION: ${{ inputs.version }} CC_YML_PATH: ${{ inputs.codecov_yml_path }} + CC_USE_PYTHON: ${{ inputs.use_python }}