Skip to content

Commit 2522d7b

Browse files
🌟 [Major]: First release (#2)
## Description - Runs a PowerShell script with the GitHub PowerShell module. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [x] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 364486d commit 2522d7b

File tree

4 files changed

+40
-35
lines changed

4 files changed

+40
-35
lines changed

.github/workflows/Action-Test.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,8 @@ jobs:
2424
- name: Action-Test
2525
uses: ./
2626
with:
27-
script: |
28-
LogGroup "Test-PSModule" {
29-
Get-GitHubZen
30-
}
31-
32-
- name: Action-Test 2
33-
uses: ./
34-
with:
35-
Verbose: true
36-
script: |
37-
LogGroup "Test-PSModule" {
27+
Token: ${{ github.token }}
28+
Script: |
29+
LogGroup "Get-GitHubZen" {
3830
Get-GitHubZen
3931
}

README.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GitHub-Script
22

3-
A GitHub Action used for running a PowerShell Script that uses the GitHub PowerShell module
3+
A GitHub Action used for running a PowerShell Script that uses the GitHub PowerShell module.
44

55
## Usage
66

@@ -12,35 +12,52 @@ A GitHub Action used for running a PowerShell Script that uses the GitHub PowerS
1212
| `Token` | The GitHub token to use | false | ${{ github.token }} |
1313
| `Debug` | Enable debug output | false | 'false' |
1414
| `Verbose` | Enable verbose output | false | 'false' |
15-
| `Version` | The version of the GitHub module to install | false | 'latest' |
15+
| `Version` | Specifies the version of the resource to be returned. The value can be an exact version or a version range using the NuGet versioning syntax. | false | 'latest' |
1616
| `Prerelease` | Allow prerelease versions if available | false | 'false' |
1717
| `WorkingDirectory` | The working directory where the script will run from | false | ${{ github.workspace }} |
1818

19-
<!--
20-
Token
21-
JWT
22-
AppID
23-
Repos
24-
Organization
25-
Host -> github.com, *.ghe.com
26-
-->
19+
### Examples
2720

28-
<!-- ### Secrets -->
21+
#### Example 1: Run a script that uses the GitHub PowerShell module
2922

30-
<!--
31-
Token
32-
JWT
33-
-->
23+
Run a script that uses the GitHub PowerShell module.
24+
This example runs a non-authenticated script that gets the GitHub Zen message.
3425

35-
<!-- ### Outputs -->
26+
```yaml
27+
jobs:
28+
Run-Script:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Run script
32+
uses: PSModule/GitHub-Script@v1
33+
with:
34+
Script: |
35+
LogGroup "Get-GitHubZen" {
36+
Get-GitHubZen
37+
}
38+
```
39+
40+
#### Example 2: Run a script that uses the GitHub PowerShell module with a token
3641
37-
### Example
42+
Run a script that uses the GitHub PowerShell module with a token.
43+
This example runs an authenticated script that gets the GitHub Zen message.
3844
3945
```yaml
40-
Example here
46+
jobs:
47+
Run-Script:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Run script
51+
uses: PSModule/GitHub-Script@v1
52+
with:
53+
Token: ${{ github.token }}
54+
Script: |
55+
LogGroup "Get-GitHubZen" {
56+
Get-GitHubZen
57+
}
4158
```
4259
43-
### Similar projects
60+
## Related projects
4461
4562
- [actions/create-github-app-token](https://github.com/actions/create-github-app-token) -> Functionality will be brought into GitHub PowerShell module.
4663
- [actions/github-script](https://github.com/actions/github-script)

action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ inputs:
1212
Token:
1313
description: The GitHub token to use.
1414
required: false
15-
default: ${{ github.token }}
1615
Debug:
1716
description: Enable debug output.
1817
required: false
@@ -55,6 +54,6 @@ runs:
5554
if ($env:GITHUB_ACTION_INPUT_Verbose -eq 'true') {
5655
$VerbosePreference = 'Continue'
5756
}
58-
. "$env:GITHUB_ACTION_PATH\scripts\main.ps1"
57+
. "${{ github.action_path }}\scripts\main.ps1"
5958
6059
${{ inputs.Script }}

tests/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)