Skip to content

Commit 5cfd476

Browse files
committed
Initial Commit.
0 parents  commit 5cfd476

20 files changed

+1020
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github/workflows/ @ephos

.github/workflows/deploy-code.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'Deploy'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
#pull_request:
8+
# branches:
9+
# - main
10+
# types: [closed]
11+
12+
jobs:
13+
validation:
14+
name: Validate Code
15+
uses: ./.github/workflows/validate-wf.yml
16+
permissions:
17+
checks: write
18+
deploy:
19+
name: Deploy
20+
runs-on: ubuntu-latest
21+
needs: validation
22+
steps:
23+
- name: Checkout Code
24+
uses: actions/checkout@v3
25+
26+
- name: Extract Repo Name
27+
id: repo_name
28+
run: echo "repo_name=$(echo '${{ github.repository }}' | cut -d '/' -f 2)" >> $GITHUB_OUTPUT
29+
30+
- name: Publish PowerShell
31+
uses: natescherer/[email protected]
32+
with:
33+
token: ${{ secrets.fake}}
34+
target: gallery
35+
path: ${{ steps.repo_name.outputs.repo_name }}/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Validation
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [opened, edited, review_requested]
8+
push:
9+
branches-ignore:
10+
- 'main'
11+
workflow_dispatch:
12+
13+
jobs:
14+
validation:
15+
name: Validate Code
16+
uses: ./.github/workflows/validate-wf.yml
17+
permissions:
18+
checks: write

.github/workflows/validate-wf.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Validation Workflow
2+
3+
# This is a reusable workflow called by other workflows
4+
5+
on:
6+
# This is going to be referenced by other workflows
7+
workflow_call:
8+
9+
jobs:
10+
validate:
11+
name: Validate Workflow
12+
runs-on: ubuntu-latest
13+
14+
# Needed for test reporting
15+
permissions:
16+
checks: write
17+
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v3
21+
22+
- name: Extract Repo Name
23+
id: repo_name
24+
run: echo "repo_name=$(echo '${{ github.repository }}' | cut -d '/' -f 2)" >> $GITHUB_OUTPUT
25+
26+
- name: Install Linting and Testing Deps
27+
shell: pwsh
28+
run: |
29+
Install-Module -Name Pester -MinimumVersion 5.5.0
30+
Install-Module -Name PSScriptAnalyzer -MinimumVersion 1.21.0
31+
32+
- name: PSScriptAnalyzer Linting
33+
shell: pwsh
34+
run: |
35+
Invoke-ScriptAnalyzer -Path ./src/
36+
37+
- name: Pester Test Runs
38+
shell: pwsh
39+
run: |
40+
$results = Invoke-Pester -Path ./tests/ -CI -PassThru
41+
$results | ConvertTo-JUnitReport -AsString | Out-File -Path testResults.xml -Force
42+
43+
- name: Version Update Check
44+
#if: ${{ github.event.pull_request.state != 'closed' }}
45+
if: github.ref != 'refs/heads/main'
46+
shell: pwsh
47+
run: |
48+
49+
# Fetch the current psd1 as it sits in main
50+
git fetch origin main:main
51+
git show FETCH_HEAD:src/${{ steps.repo_name.outputs.repo_name }}.psd1 | Out-File -Path main-manifest.psd1
52+
53+
# Get the current Git commit hash and main branch hash.
54+
$mainCommitId = & git rev-parse main
55+
$branchCommitId = & git rev-parse HEAD
56+
"`nGit Commit Hashes:"
57+
"`tMain Commit Hash ID: `e[38;2;56;136;255m $mainCommitId `e[0m"
58+
"`tBranch Commit Hash ID: `e[38;2;56;136;255m $branchCommitId `e[0m"
59+
60+
"`nFetching current Manifest ModuleVersion from main..."
61+
$prevManifest = Import-PowerShellDataFile -Path ./main-manifest.psd1
62+
$prevVer = [System.Version]::Parse($prevManifest.ModuleVersion)
63+
64+
# Import the current manifest
65+
"Fetching new Manifest ModuleVersion from branch..."
66+
$branchManifest = Import-PowerShellDataFile -Path ./src/*psd1
67+
$branchVer = [System.Version]::Parse($branchManifest.ModuleVersion)
68+
69+
"`nVersions:"
70+
"`tNew Version (branch $env:GITHUB_REF_NAME):`e[38;2;56;136;255m $branchVer `e[0m "
71+
"`tPrevious Version (branch main):`e[38;2;56;136;255m $prevVer `e[0m "
72+
"`n"
73+
74+
# Check if version hasnt been udpated
75+
if ($mainCommitId -eq $branchCommitId) {
76+
"ℹ️ No new Git commits have been pushed to this branch yet, branch ($branchCommitId) and main ($mainCommitId) Git commit hashes are equal."
77+
} elseif ($prevVer -eq $branchVer) {
78+
"`e[38;2;255;0;0m❌ Branch Module Manfiest version ($branchVer) matches the main branch version ($prevVer), please update!`e[0m"
79+
exit 1
80+
} elseif ($branchVer -lt $prevVer) {
81+
"`e[38;2;255;0;0m❌ SemVer violation! ($branchVer) cannot be less than ($prevVer), please update!`e[0m"
82+
exit 1
83+
} else {
84+
"`e[38;2;0;255;0m✅ Version check pass! Good job, you're a SemVer pro 😎!`e[0m"
85+
}
86+
87+
- name: Report Tests
88+
uses: dorny/[email protected]
89+
if: success() || failure()
90+
with:
91+
name: Pester Test Results
92+
path: testResults.xml
93+
reporter: jest-junit

.gitignore

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
##################################
2+
### Vim/NeoVim
3+
4+
# Swap
5+
[._]*.s[a-v][a-z]
6+
!*.svg # comment out if you don't need vector files
7+
[._]*.sw[a-p]
8+
[._]s[a-rt-v][a-z]
9+
[._]ss[a-gi-z]
10+
[._]sw[a-p]
11+
12+
# Session
13+
Session.vim
14+
Sessionx.vim
15+
16+
# Temporary
17+
.netrwhist
18+
*~
19+
# Auto-generated tag files
20+
tags
21+
# Persistent undo
22+
[._]*.un~
23+
24+
##################################
25+
### PowerShell
26+
27+
bin/
28+
obj/
29+
.ionide/
30+
project.lock.json
31+
*-tests.xml
32+
/debug/
33+
/staging/
34+
/Packages/
35+
*.nuget.props
36+
37+
# dotnet cli install/uninstall scripts
38+
dotnet-install.ps1
39+
dotnet-install.sh
40+
dotnet-uninstall-pkgs.sh
41+
dotnet-uninstall-debian-packages.sh
42+
43+
# VS auto-generated solution files for project.json solutions
44+
*.xproj
45+
*.xproj.user
46+
*.suo
47+
48+
# VS auto-generated files for csproj files
49+
*.csproj.user
50+
51+
# Visual Studio IDE directory
52+
.vs/
53+
54+
# VSCode directories that are not at the repository root
55+
/**/.vscode/
56+
57+
# Project Rider IDE files
58+
.idea.powershell/
59+
60+
# Ignore executables
61+
*.exe
62+
*.msi
63+
*.appx
64+
*.msix
65+
66+
# Ignore binaries and symbols
67+
*.pdb
68+
*.dll
69+
*.wixpdb
70+
71+
# Ignore packages
72+
*.deb
73+
*.tar.gz
74+
*.zip
75+
*.rpm
76+
*.pkg
77+
*.nupkg
78+
*.AppImage
79+
80+
# default location for produced nuget packages
81+
/nuget-artifacts
82+
83+
# resgen output
84+
gen
85+
86+
# Per repo profile
87+
.profile.ps1
88+
89+
# macOS
90+
.DS_Store
91+
.DocumentRevisions-V100
92+
.fseventsd
93+
.Spotlight-V100
94+
.TemporaryItems
95+
.Trashes
96+
.VolumeIcon.icns
97+
.com.apple.timemachine.donotpresent
98+
.AppleDB
99+
.AppleDesktop
100+
Network Trash Folder
101+
Temporary Items
102+
.apdisk
103+
.AppleDouble
104+
.LSOverride
105+
106+
# TestsResults
107+
TestsResults*.xml
108+
ParallelXUnitResults.xml
109+
xUnitResults.xml
110+
111+
# Resharper settings
112+
PowerShell.sln.DotSettings.user
113+
*.msp
114+
StyleCop.Cache
115+
116+
# Ignore SelfSignedCertificate autogenerated files
117+
test/tools/Modules/SelfSignedCertificate/
118+
119+
# BenchmarkDotNet artifacts
120+
test/perf/BenchmarkDotNet.Artifacts/
121+
122+
# Test generated module
123+
test/tools/Modules/Microsoft.PowerShell.NamedPipeConnection/
124+
125+
# Test generated startup profile
126+
StartupProfileData-NonInteractive
127+
128+
# Ignore logfiles
129+
logfile/*
130+
131+
# Pester test results
132+
testResults.xml
133+
134+
##################################
135+
### Local dev files
136+
_debug.ps1
137+
_demo.ps1
138+
_testing.ps1

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2023 Rob (Ephos) Pleau
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SWAPI (Star Wars API) PowerShell Module
2+
3+
## Overview
4+
5+
A PowerShell module to interface with the Star Wars API (SWAPI).
6+
7+
Tested on.
8+
9+
| OS | PowerShell Version |
10+
| --- | --- |
11+
| Arch <span style="color:cyan">󰣇 </span>Linux 🐧 | 7.3.5 |
12+
13+
## Current Known Issues
14+
15+
- Lack of [RFC 5988](https://datatracker.ietf.org/doc/html/rfc5988) support
16+
* It doesn't seem to be implmented in a way that lets `Invoke-RestMethod`'s `-FollowRelLink` to work.
17+
* This creates a need to implement a work around for pagination, the API return is quite slow.
18+
* Workaround, try to use parameters to filter the request instead of doing a get-all on the endpoint.
19+
20+
## To-Do
21+
22+
- [ ] Implement help for functions
23+
- [ ] Implement 'wookiee' mode formatting
24+
25+

0 commit comments

Comments
 (0)