From 1cbeb2c650f89051d9f4606d4b42017d12a3b7fa Mon Sep 17 00:00:00 2001 From: Srijan Saurav Date: Thu, 22 May 2025 15:23:17 +0530 Subject: [PATCH 1/2] feat: add ability to use OIDC to report coverage --- action.yml | 4 ++++ main.py | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index fb4d3b6..744df40 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,10 @@ inputs: description: 'HEAD commit for which the Test Coverage report is being sent' required: false default: ${{ github.event.pull_request.head.sha }} + use-oidc: + description: 'Use OIDC token instead of DSN. Allowed values are — true, false' + required: false + default: false branding: color: 'green' icon: 'umbrella' diff --git a/main.py b/main.py index 9736716..504fe74 100755 --- a/main.py +++ b/main.py @@ -11,6 +11,7 @@ "dsn": "INPUT_DSN", "fail_ci_on_error": "INPUT_FAIL-CI-ON-ERROR", "commit_sha": "INPUT_COMMIT-SHA", + "use_oidc": "INPUT_USE-OIDC", } DEEPSOURCE_CLI_PATH = "/app/bin/deepsource" @@ -54,6 +55,9 @@ def main() -> None: input_data["coverage_file"], ] + if input_data["use_oidc"] == "true": + command.append("--use-oidc") + # change the current working directory to the GitHub repository's context os.chdir(GITHUB_WORKSPACE_PATH) @@ -68,10 +72,9 @@ def main() -> None: capture_output=True, ) - if process.returncode != 0: - if input_data["fail_ci_on_error"] == "true": - print(f"::error file:main.py::{process.stdout.decode('utf-8')}") - sys.exit(1) + if process.returncode != 0 and input_data["fail_ci_on_error"] == "true": + print(f"::error file:main.py::{process.stdout.decode('utf-8')}") + sys.exit(1) print(process.stdout.decode("utf-8")) print(process.stderr.decode("utf-8"), file=sys.stderr) From 118eba80965c6dc4fffd2161ca0e673625e7d7f9 Mon Sep 17 00:00:00 2001 From: Srijan Saurav <68371686+srijan-deepsource@users.noreply.github.com> Date: Mon, 26 May 2025 11:37:30 +0530 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Srijan Saurav <68371686+srijan-deepsource@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 744df40..e009a55 100644 --- a/action.yml +++ b/action.yml @@ -21,7 +21,7 @@ inputs: use-oidc: description: 'Use OIDC token instead of DSN. Allowed values are — true, false' required: false - default: false + default: 'false' branding: color: 'green' icon: 'umbrella'