Skip to content

Commit 7077759

Browse files
test: Attempting images in action summary ( Fixes #132 )
1 parent 4d6fa22 commit 7077759

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

action.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ runs:
5555
id: TurtleAction
5656
shell: pwsh
5757
env:
58-
GitHubToken: ${{inputs.GitHubToken}}
59-
SkipScriptFile: ${{inputs.SkipScriptFile}}
60-
NoPush: ${{inputs.NoPush}}
61-
ActionScript: ${{inputs.ActionScript}}
62-
InstallModule: ${{inputs.InstallModule}}
63-
NoCommit: ${{inputs.NoCommit}}
64-
TargetBranch: ${{inputs.TargetBranch}}
65-
CommitMessage: ${{inputs.CommitMessage}}
6658
UserName: ${{inputs.UserName}}
59+
CommitMessage: ${{inputs.CommitMessage}}
6760
Run: ${{inputs.Run}}
6861
UserEmail: ${{inputs.UserEmail}}
62+
SkipScriptFile: ${{inputs.SkipScriptFile}}
63+
TargetBranch: ${{inputs.TargetBranch}}
64+
ActionScript: ${{inputs.ActionScript}}
65+
GitHubToken: ${{inputs.GitHubToken}}
66+
NoCommit: ${{inputs.NoCommit}}
67+
NoPush: ${{inputs.NoPush}}
68+
InstallModule: ${{inputs.InstallModule}}
6969
run: |
7070
$Parameters = @{}
7171
$Parameters.Run = ${env:Run}
@@ -308,6 +308,7 @@ runs:
308308
"### $($scriptFile.Fullname -replace [Regex]::Escape($env:GITHUB_WORKSPACE))" |
309309
Out-File -Append -FilePath $env:GITHUB_STEP_SUMMARY
310310
}
311+
311312
$scriptCmd = $ExecutionContext.SessionState.InvokeCommand.GetCommand($scriptFile.FullName, 'ExternalScript')
312313
foreach ($requiredModule in $CommandInfo.ScriptBlock.Ast.ScriptRequirements.RequiredModules) {
313314
if ($requiredModule.Name -and
@@ -421,6 +422,15 @@ runs:
421422
} elseif ($outItem) {
422423
$outItem.FullName, (git status $outItem.Fullname -s)
423424
}
425+
if ($fullname -match '\.(svg|png)' -and $env:GITHUB_STEP_SUMMARY) {
426+
$leafName = $fullName | Split-Path -Leaf
427+
$imageFileDestination = $env:GITHUB_STEP_SUMMARY |
428+
Split-Path |
429+
Join-Path -ChildPath $leafName
430+
Copy-Item -LiteralPath $fullName -Destination $imageFileDestination
431+
"![$leafName]($leafName)" |
432+
Out-File -Append -FilePath $env:GITHUB_STEP_SUMMARY
433+
}
424434
if ($shouldCommit -and -not $NoCommit) {
425435
"$fullName has changed, and should be committed" | Out-Host
426436
git add $fullName

0 commit comments

Comments
 (0)