Amadevus / pwsh-script

GitHub Action to run PowerShell scripts in a rich, prepared scope - inspired by actions/github-script.
MIT License
47 stars 8 forks source link

Demo #2

Open amis92 opened 4 years ago

amis92 commented 4 years ago

There's a slash-command available to try out the action. Simply comment on this issue with /demo in the first line and a PowerShell script in the following lines. If your comment will contain a code-block (fenced or not), contents of it will be executed instead of whole comment body - and it'll look better! :)

For example, comment with:

/demo

```powershell
return (1 + 1)
```

You should get a result (and/or an error) in a comment that will follow.

ℹ Please note, for security $github.token is not available in the demo script. It's available all right in normal action executions. :)

amis92 commented 4 years ago

/demo

return (1 + 1)

Workflow run

github-actions[bot] commented 4 years ago

result output:

2

error output:

amis92 commented 4 years ago

/demo

1 + 1 Workflow run

github-actions[bot] commented 4 years ago

result output:

2

error output:

amis92 commented 4 years ago

/demo

$github.repository $github.repository = "changed" $github.repository Workflow run

github-actions[bot] commented 4 years ago

result output:

[
  "Amadevus/pwsh-script",
  "changed"
]

error output:

pberthonneau commented 3 years ago

/demo

echo $github.actor Workflow run

github-actions[bot] commented 3 years ago

result output:

amis92

error output:

lzinga commented 3 years ago

/demo

echo $github.workspace Workflow run

github-actions[bot] commented 3 years ago

result output:

/home/runner/work/pwsh-script/pwsh-script

error output:

AjayKMehta commented 3 years ago

/demo

Get-Date

Workflow run

github-actions[bot] commented 3 years ago

result output:

"2021-07-13T05:36:32.3956555+00:00"

error output:

amis92 commented 3 years ago

/demo

Set-ActionOutput testout igottest Workflow run

github-actions[bot] commented 3 years ago

result output:

error output:

craigforneris commented 2 years ago

/demo

return (1 + 1)

Workflow run

github-actions[bot] commented 2 years ago

result output:

2

error output:

planetacomputer commented 2 years ago

/demo Write-Output 'Hi' Workflow run

github-actions[bot] commented 2 years ago

result output:

Hi

error output:

github-actions[bot] commented 2 years ago

result output:

error output:

Pride7K commented 2 years ago

/demo Workflow run

github-actions[bot] commented 2 years ago

result output:

error output:

Pride7K commented 2 years ago

/demo

Set-Culture -CultureInfo pt-BR

Workflow run

github-actions[bot] commented 2 years ago

result output:

error output:

The term 'Set-Culture' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Pride7K commented 2 years ago

/demo

Set-Culture -CultureInfo pt-BR

Workflow run

github-actions[bot] commented 2 years ago

result output:

error output:

The term 'Set-Culture' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
maniac-en commented 2 years ago

/demo

return (1+1)

Workflow run

github-actions[bot] commented 2 years ago

result output:

2

error output:

SupremeOverlordTheFirst commented 2 years ago

/demo

Write-ActionDebug $github.run_number
Write-ActionDebug "Test"

Workflow run

github-actions[bot] commented 2 years ago

result output:

error output:

SupremeOverlordTheFirst commented 2 years ago

/demo

return ($github.run_number) 

Workflow run

github-actions[bot] commented 2 years ago

result output:

21

error output:

SupremeOverlordTheFirst commented 2 years ago

/demo

return ("test: ${github.run_number")" 

Workflow run

github-actions[bot] commented 2 years ago

result output:

error output:

At line:3 char:17
+ return ("test: ${github.run_number")"
+                 ~~~~~~~~~~~~~~~~~~~~~
${{variable}} reference starting is missing the closing '}}'.

At line:3 char:9
+ return ("test: ${github.run_number")"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The string is missing the terminator: ".

At line:3 char:38
+ return ("test: ${github.run_number")"
+                                      ~
Missing closing ')' in expression.
SupremeOverlordTheFirst commented 2 years ago

/demo

return ("test: ${github.run_number}") 

Workflow run

github-actions[bot] commented 2 years ago

result output:

test: 

error output:

SupremeOverlordTheFirst commented 2 years ago

/demo

return ("test: ${$github.run_number}") 

Workflow run

github-actions[bot] commented 2 years ago

result output:

test: 

error output:

SupremeOverlordTheFirst commented 2 years ago

/demo

return ("test: ${$github.workspace}") 

Workflow run

github-actions[bot] commented 2 years ago

result output:

test: 

error output:

amis92 commented 2 years ago

@SupremeOverlordTheFirst you need to use normal parentheses/round brackets: $(), such as:

amis92 commented 2 years ago

/demo

"test: $($github.workspace)" Workflow run

github-actions[bot] commented 2 years ago

result output:

test: /home/runner/work/pwsh-script/pwsh-script

error output:

SupremeOverlordTheFirst commented 2 years ago

@SupremeOverlordTheFirst you need to use normal parentheses/round brackets: $(), such as:

Thank you, yes got it working, sorry for spamming the comments :)

MareMare commented 2 years ago

/demo

return [ordered]@{ x = 'a1'; y = 'b2' }

Workflow run

github-actions[bot] commented 2 years ago

result output:

{
  "x": "a1",
  "y": "b2"
}

error output:

gnpaone commented 2 years ago

/demo Get-ExecutionPolicy Workflow run

github-actions[bot] commented 2 years ago

result output:

error output:

The term 'Get-ExecutionPolicy
' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
bala503 commented 1 year ago

/demo Workflow run

github-actions[bot] commented 1 year ago

result output:

error output:

bala503 commented 1 year ago

/demo get-date Workflow run