Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Pick up PR's head commit from GitHub context #29

Merged
merged 2 commits into from
Aug 24, 2023
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
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'GitHub Action that uploads test coverage reports to DeepSource for
author: 'Sanket Saurav <sanket@deepsource.io>'
inputs:
key:
description: 'Programming language shortcode for which coverage is reported. Allowed values are — python, go'
description: 'Programming language shortcode for which coverage is reported. Allowed values are — python, go, javascript, ruby, java, kotlin, scala, php, csharp, cxx, rust, swift'
required: true
coverage-file:
description: 'Path to the coverage data file. e.g. ./coverage.xml'
Expand All @@ -14,6 +14,10 @@ inputs:
fail-ci-on-error:
description: 'Should the CI build fail if there is an error while uploading the report to DeepSource? Allowed values are — true, false'
default: false
commit-sha:
description: 'HEAD commit for which the Test Coverage report is being sent'
required: false
default: ${{ github.event.pull_request.head.sha }}
branding:
color: 'green'
icon: 'umbrella'
Expand Down
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"coverage_file": "INPUT_COVERAGE-FILE",
"dsn": "INPUT_DSN",
"fail_ci_on_error": "INPUT_FAIL-CI-ON-ERROR",
"commit_sha": "INPUT_COMMIT-SHA",
}

DEEPSOURCE_CLI_PATH = "/app/bin/deepsource"
Expand Down Expand Up @@ -45,7 +46,11 @@ def main() -> None:
# skipcq: BAN-B603, PYL-W1510
process = subprocess.run(
command,
env=dict(os.environ, DEEPSOURCE_DSN=input_data["dsn"]),
env=dict(
os.environ,
DEEPSOURCE_DSN=input_data["dsn"],
GHA_HEAD_COMMIT_SHA=input_data["commit_sha"],
),
capture_output=True,
)

Expand Down