Skip to content

Commit

Permalink
Add property for setting SHA
Browse files Browse the repository at this point in the history
- Allows overriding the 'auto-detection' logic

Fixes zyborg#29
  • Loading branch information
flcdrg committed Jul 23, 2021
1 parent 69608ac commit 3b7e6a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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

0 comments on commit 3b7e6a1

Please sign in to comment.