Skip to content

Commit 5e821bd

Browse files
feat: pick up PR's head commit from GitHub context (#29)
1 parent 4e5182f commit 5e821bd

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: 'GitHub Action that uploads test coverage reports to DeepSource for
33
author: 'Sanket Saurav <[email protected]>'
44
inputs:
55
key:
6-
description: 'Programming language shortcode for which coverage is reported. Allowed values are — python, go'
6+
description: 'Programming language shortcode for which coverage is reported. Allowed values are — python, go, javascript, ruby, java, kotlin, scala, php, csharp, cxx, rust, swift'
77
required: true
88
coverage-file:
99
description: 'Path to the coverage data file. e.g. ./coverage.xml'
@@ -14,6 +14,10 @@ inputs:
1414
fail-ci-on-error:
1515
description: 'Should the CI build fail if there is an error while uploading the report to DeepSource? Allowed values are — true, false'
1616
default: false
17+
commit-sha:
18+
description: 'HEAD commit for which the Test Coverage report is being sent'
19+
required: false
20+
default: ${{ github.event.pull_request.head.sha }}
1721
branding:
1822
color: 'green'
1923
icon: 'umbrella'

main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"coverage_file": "INPUT_COVERAGE-FILE",
1111
"dsn": "INPUT_DSN",
1212
"fail_ci_on_error": "INPUT_FAIL-CI-ON-ERROR",
13+
"commit_sha": "INPUT_COMMIT-SHA",
1314
}
1415

1516
DEEPSOURCE_CLI_PATH = "/app/bin/deepsource"
@@ -45,7 +46,11 @@ def main() -> None:
4546
# skipcq: BAN-B603, PYL-W1510
4647
process = subprocess.run(
4748
command,
48-
env=dict(os.environ, DEEPSOURCE_DSN=input_data["dsn"]),
49+
env=dict(
50+
os.environ,
51+
DEEPSOURCE_DSN=input_data["dsn"],
52+
GHA_HEAD_COMMIT_SHA=input_data["commit_sha"],
53+
),
4954
capture_output=True,
5055
)
5156

0 commit comments

Comments
 (0)