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

Add property for setting SHA #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion action.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ $inputs = @{
trx_xsl_path = Get-ActionInput trx_xsl_path
extra_test_parameters = Get-ActionInput extra_test_parameters
fail_build_on_failed_tests = Get-ActionInput fail_build_on_failed_tests
sha = Get-ActionInput sha
}

$tmpDir = [System.IO.Path]::Combine($PWD, '_TMP')
Expand Down Expand Up @@ -95,14 +96,19 @@ function Publish-ToCheckRun {

Write-ActionInfo "Resolving REF"
$ref = $ctx.Sha
if ($ctx.EventName -eq 'pull_request') {

if ($inputs.sha) {
Write-ActionInfo "Resolving as input sha"
$ref = $inputs.sha
} elseif ($ctx.EventName -eq 'pull_request') {
Write-ActionInfo "Resolving PR REF"
$ref = $ctx.Payload.pull_request.head.sha
if (-not $ref) {
Write-ActionInfo "Resolving PR REF as AFTER"
$ref = $ctx.Payload.after
}
}

if (-not $ref) {
Write-ActionError "Failed to resolve REF"
exit 1
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ inputs:

fail_build_on_failed_tests:
description: |
If set to true, the build will fail if at least one test fails
If set to true, the build will fail if at least one test fails

sha:
description: The commit that the report check will be associated with. This is auto-detected by default.
required: false


## Here you describe your *formal* outputs.
Expand Down