Skip to content

Commit

Permalink
feat: pick up PR's head commit from GitHub context (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
srijan-deepsource authored Aug 24, 2023
1 parent 4e5182f commit 5e821bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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

0 comments on commit 5e821bd

Please sign in to comment.