From f18f2d520f059476b513ef3b048bdcfc053d43aa Mon Sep 17 00:00:00 2001 From: Tom Hu <88201630+thomasrockhu-codecov@users.noreply.github.com> Date: Wed, 17 Apr 2024 09:05:14 -0700 Subject: [PATCH] Th/create default name (#421) * fix: add some logs and test * fix: verbose * fix: maybe get more data * fix: add name to fallbacks * fix: default to build_code * fix: update the option * fix: cleanup * fix: cleanup again * fix: last cleanup --- .github/workflows/ci.yml | 4 ++-- codecov_cli/commands/upload.py | 2 ++ codecov_cli/fallbacks.py | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb55e118..b0da70b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,8 +80,8 @@ jobs: - name: Dogfooding codecov-cli if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }} run: | - codecovcli do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} - codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} + codecovcli -v do-upload --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} + codecovcli do-upload --report-type test_results --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} --plugin pycoverage --flag python${{matrix.python-version}} static-analysis: runs-on: ubuntu-latest diff --git a/codecov_cli/commands/upload.py b/codecov_cli/commands/upload.py index aa9e7f75..377553c2 100644 --- a/codecov_cli/commands/upload.py +++ b/codecov_cli/commands/upload.py @@ -98,6 +98,8 @@ def _turn_env_vars_into_dict(ctx, params, value): "-n", "--name", help="Custom defined name of the upload. Visible in Codecov UI", + cls=CodecovOption, + fallback_field=FallbackFieldEnum.build_code, ), click.option( "-B", diff --git a/codecov_cli/fallbacks.py b/codecov_cli/fallbacks.py index d84c6eb6..2c8f9b33 100644 --- a/codecov_cli/fallbacks.py +++ b/codecov_cli/fallbacks.py @@ -5,15 +5,15 @@ class FallbackFieldEnum(Enum): - commit_sha = auto() - build_url = auto() + branch = auto() build_code = auto() + build_url = auto() + commit_sha = auto() + git_service = auto() job_code = auto() pull_request_number = auto() - slug = auto() - branch = auto() service = auto() - git_service = auto() + slug = auto() class CodecovOption(click.Option):