-
Notifications
You must be signed in to change notification settings - Fork 3
Using PowerShell
dfinke edited this page Feb 22, 2021
·
2 revisions
The powershell template has been already provided along with this release. The template looks like:
# Template for basic PowerShell automation
name: Custom PowerShell Automation
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run the scripts
shell: pwsh
run: |
$command
Few important points the template says:
- It instructs GitHub Actions to run only on
workflow_dispatch
, i.e. on manual trigger. - It tells the tool that it accepts a command which needs to be supplied by the
-command
argument.
Lets see a simplified usage of things:
- Create a new repository
pstest
and clone it locally undercustom/
folder.New-GHRepo $repoName -clone
- Now, put all your scripts inside the fresh cloned repository.
$defaultPath = "./custom" '"Hello World"' > $defaultPath/$repoName/hello.ps1 '"Howdy"' > $defaultPath/$repoName/howdy.ps1 '"So long"' > $defaultPath/$repoName/bye.ps1 '"Fare thee well"' > $defaultPath/$repoName/farewell.ps1
- Now its time to push these to GitHub. The below command will automatically commit the files and push it to GitHub. Note,
Invoke-GHPush
takes in a repository name cloned undercustom/
folder.Invoke-GHPush $repoName
- Time for the actual hack. Specify your command through the
-command
parameter. You can specify multiple commands using bash separators like&&
or semicolons;
. Also we instruct Invoke-Advantage to save the runtime logs locally.Invoke-Advantage -owner dfinke -repo pstest -template basic-powershell -c './hello.ps1 && ./howdy.ps1' --save-logs ./logsdir
That's it! Now go ahead and check your results. PSAdvantage is as flexible as your thoughts!
- Home Welcome to PSAdvantage Wiki!
- Getting Started Getting started and setting up PSAdvantage.
- General Usage Basics of using PSAdvantage.
- Templates All about the templating engine.
- Use Cases Few exemplary use cases on how PSAdvantage could be used.