From ab76097814939065ccb1f653208d738dca44c396 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 20 Jul 2024 18:44:38 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Enable=20publishi?= =?UTF-8?q?ng=20docs=20to=20GitHub=20Pages=20-=20Bump=20Process-PSModule?= =?UTF-8?q?=20to=20v2=20-=20Add=20pages=20and=20id-token=20permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Linter.yml | 29 +++++++++++++++++++++++ .github/workflows/Nightly-Run.yml | 17 +++++++++++++ .github/workflows/Process-PSModule.yml | 4 +++- linters/.markdown-lint.yml | 25 +++++++++++++++++++ linters/.powershell-psscriptanalyzer.psd1 | 17 +++++++++++++ 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/Linter.yml create mode 100644 .github/workflows/Nightly-Run.yml create mode 100644 linters/.markdown-lint.yml create mode 100644 linters/.powershell-psscriptanalyzer.psd1 diff --git a/.github/workflows/Linter.yml b/.github/workflows/Linter.yml new file mode 100644 index 0000000..5c9f300 --- /dev/null +++ b/.github/workflows/Linter.yml @@ -0,0 +1,29 @@ +name: Linter + +run-name: "Linter - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" + +on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + packages: read + statuses: write + +jobs: + Lint: + name: Lint code base + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Lint code base + uses: super-linter/super-linter@latest + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/Nightly-Run.yml b/.github/workflows/Nightly-Run.yml new file mode 100644 index 0000000..f220edb --- /dev/null +++ b/.github/workflows/Nightly-Run.yml @@ -0,0 +1,17 @@ +name: Nightly run + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +permissions: + contents: write + issues: write + pull-requests: write + statuses: write + +jobs: + Process-PSModule: + uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v1 + secrets: inherit diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index b14321b..ac141ba 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -19,8 +19,10 @@ concurrency: permissions: contents: write pull-requests: write + pages: write + id-token: write jobs: Process-PSModule: - uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v1 + uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v2 secrets: inherit diff --git a/linters/.markdown-lint.yml b/linters/.markdown-lint.yml new file mode 100644 index 0000000..b9ecdfa --- /dev/null +++ b/linters/.markdown-lint.yml @@ -0,0 +1,25 @@ +########################### +## Markdown Linter rules ## +########################### + +# Linter rules doc: +# - https://github.com/DavidAnson/markdownlint + +############### +# Rules by id # +############### +MD004: false # Unordered list style +MD007: + indent: 2 # Unordered list indentation +MD013: + line_length: 808 # Line length +MD026: + punctuation: ".,;:!。,;:" # List of not allowed +MD029: false # Ordered list item prefix +MD033: false # Allow inline HTML +MD036: false # Emphasis used instead of a heading + +################# +# Rules by tags # +################# +blank_lines: false # Error on blank lines diff --git a/linters/.powershell-psscriptanalyzer.psd1 b/linters/.powershell-psscriptanalyzer.psd1 new file mode 100644 index 0000000..570ac0d --- /dev/null +++ b/linters/.powershell-psscriptanalyzer.psd1 @@ -0,0 +1,17 @@ +#Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/Cmdlets/Invoke-ScriptAnalyzer.md#-settings +@{ + #CustomRulePath='path\to\CustomRuleModule.psm1' + #RecurseCustomRulePath='path\of\customrules' + #Severity = @( + # 'Error' + # 'Warning' + #) + #IncludeDefaultRules=${true} + ExcludeRules = @( + 'PSMissingModuleManifestField' + ) + #IncludeRules = @( + # 'PSAvoidUsingWriteHost', + # 'MyCustomRuleName' + #) +} From 9410f6eb139eb4ba58ee183134785a2c329592f5 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 20 Jul 2024 21:11:01 +0200 Subject: [PATCH 2/5] - Add mkdocs.yml settings file --- mkdocs.yml | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 mkdocs.yml diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..df5e17a --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,75 @@ +site_name: -{{ REPO_NAME }}- +theme: + name: material + language: en + font: + text: Roboto + code: Sono + logo: Assets/icon.png + favicon: Assets/icon.png + palette: + # Palette toggle for automatic mode + - media: "(prefers-color-scheme)" + toggle: + icon: material/link + name: Switch to dark mode + # Palette toggle for dark mode + - media: '(prefers-color-scheme: dark)' + scheme: slate + toggle: + primary: black + accent: green + icon: material/toggle-switch-off-outline + name: Switch to light mode + # Palette toggle for light mode + - media: '(prefers-color-scheme: light)' + scheme: default + toggle: + primary: indigo + accent: green + icon: material/toggle-switch + name: Switch to system preference + icon: + repo: material/github + features: + - navigation.instant + - navigation.instant.progress + - navigation.indexes + - navigation.top + - navigation.tracking + - navigation.expand + - search.suggest + - search.highlight + +repo_name: -{{ REPO_OWNER }}-/-{{ REPO_NAME }}- +repo_url: https://github.com/-{{ REPO_OWNER }}-/-{{ REPO_NAME }}- + +plugins: + - search + +markdown_extensions: + - toc: + permalink: true # Adds a link icon to headings + - attr_list + - admonition + - md_in_html + - pymdownx.details # Enables collapsible admonitions + +extra: + social: + - icon: fontawesome/brands/discord + link: https://discord.gg/jedJWCPAhD + name: -{{ REPO_OWNER }}- on Discord + - icon: fontawesome/brands/github + link: https://github.com/-{{ REPO_OWNER }}-/ + name: -{{ REPO_OWNER }}- on GitHub + consent: + title: Cookie consent + description: >- + We use cookies to recognize your repeated visits and preferences, as well + as to measure the effectiveness of our documentation and whether users + find what they're searching for. With your consent, you're helping us to + make our documentation better. + actions: + - accept + - reject From df18706b69397bcc2dd7730528121c53d2cdc519 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 20 Jul 2024 23:45:09 +0200 Subject: [PATCH 3/5] Fix --- {linters => .github/linters}/.markdown-lint.yml | 0 {linters => .github/linters}/.powershell-psscriptanalyzer.psd1 | 0 .github/workflows/Process-PSModule.yml | 1 + 3 files changed, 1 insertion(+) rename {linters => .github/linters}/.markdown-lint.yml (100%) rename {linters => .github/linters}/.powershell-psscriptanalyzer.psd1 (100%) diff --git a/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml similarity index 100% rename from linters/.markdown-lint.yml rename to .github/linters/.markdown-lint.yml diff --git a/linters/.powershell-psscriptanalyzer.psd1 b/.github/linters/.powershell-psscriptanalyzer.psd1 similarity index 100% rename from linters/.powershell-psscriptanalyzer.psd1 rename to .github/linters/.powershell-psscriptanalyzer.psd1 diff --git a/.github/workflows/Process-PSModule.yml b/.github/workflows/Process-PSModule.yml index ac141ba..b98ed7c 100644 --- a/.github/workflows/Process-PSModule.yml +++ b/.github/workflows/Process-PSModule.yml @@ -19,6 +19,7 @@ concurrency: permissions: contents: write pull-requests: write + statuses: write pages: write id-token: write From 80e7accffcfdb6cdcf876643191089c69f28bd9a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 20 Jul 2024 23:52:12 +0200 Subject: [PATCH 4/5] FIx --- src/GraphQL/GraphQL.psd1 | 3 --- src/GraphQL/GraphQL.psm1 | 32 ---------------------------- src/GraphQL/public/Get-PSModule.ps1 | 2 +- src/GraphQL/public/New-PSModule.ps1 | 2 +- src/GraphQL/public/Set-PSModule.ps1 | 2 +- src/GraphQL/public/Test-PSModule.ps1 | 2 +- 6 files changed, 4 insertions(+), 39 deletions(-) delete mode 100644 src/GraphQL/GraphQL.psd1 delete mode 100644 src/GraphQL/GraphQL.psm1 diff --git a/src/GraphQL/GraphQL.psd1 b/src/GraphQL/GraphQL.psd1 deleted file mode 100644 index 9bbe918..0000000 --- a/src/GraphQL/GraphQL.psd1 +++ /dev/null @@ -1,3 +0,0 @@ -@{ - ModuleVersion = '0.0.0' -} diff --git a/src/GraphQL/GraphQL.psm1 b/src/GraphQL/GraphQL.psm1 deleted file mode 100644 index 302c035..0000000 --- a/src/GraphQL/GraphQL.psm1 +++ /dev/null @@ -1,32 +0,0 @@ -[Cmdletbinding()] -param() - -Write-Verbose 'Importing subcomponents' -$Folders = 'classes', 'private', 'public' -# Import everything in these folders -Foreach ($Folder in $Folders) { - $Root = Join-Path -Path $PSScriptRoot -ChildPath $Folder - Write-Verbose "Processing folder: $Root" - if (Test-Path -Path $Root) { - Write-Verbose "Getting all files in $Root" - $Files = $null - $Files = Get-ChildItem -Path $Root -Include '*.ps1', '*.psm1' -Recurse - # dot source each file - foreach ($File in $Files) { - Write-Verbose "Importing $($File)" - Import-Module $File - Write-Verbose "Importing $($File): Done" - } - } -} - -$Param = @{ - Function = (Get-ChildItem -Path "$PSScriptRoot\public" -Include '*.ps1' -Recurse).BaseName - Variable = '*' - Cmdlet = '*' - Alias = '*' -} - -Write-Verbose 'Exporting module members' - -Export-ModuleMember @Param diff --git a/src/GraphQL/public/Get-PSModule.ps1 b/src/GraphQL/public/Get-PSModule.ps1 index a863227..3b07a69 100644 --- a/src/GraphQL/public/Get-PSModule.ps1 +++ b/src/GraphQL/public/Get-PSModule.ps1 @@ -1,4 +1,4 @@ -Function Get-PSModule { +function Get-PSModule { <# .SYNOPSIS Performs tests on a module. diff --git a/src/GraphQL/public/New-PSModule.ps1 b/src/GraphQL/public/New-PSModule.ps1 index fda4417..fcea178 100644 --- a/src/GraphQL/public/New-PSModule.ps1 +++ b/src/GraphQL/public/New-PSModule.ps1 @@ -1,4 +1,4 @@ -Function New-PSModule { +function New-PSModule { <# .SYNOPSIS Performs tests on a module. diff --git a/src/GraphQL/public/Set-PSModule.ps1 b/src/GraphQL/public/Set-PSModule.ps1 index 78439b3..4677cf3 100644 --- a/src/GraphQL/public/Set-PSModule.ps1 +++ b/src/GraphQL/public/Set-PSModule.ps1 @@ -1,4 +1,4 @@ -Function Set-PSModule { +function Set-PSModule { <# .SYNOPSIS Performs tests on a module. diff --git a/src/GraphQL/public/Test-PSModule.ps1 b/src/GraphQL/public/Test-PSModule.ps1 index 131dcff..5be2c11 100644 --- a/src/GraphQL/public/Test-PSModule.ps1 +++ b/src/GraphQL/public/Test-PSModule.ps1 @@ -1,4 +1,4 @@ -Function Test-PSModule { +function Test-PSModule { <# .SYNOPSIS Performs tests on a module. From 8888aa9c704b40fb853ab41336851284a9181944 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 21 Jul 2024 00:00:07 +0200 Subject: [PATCH 5/5] Fix --- .vscode/extensions.json | 6 --- .vscode/settings.json | 81 ----------------------------------------- 2 files changed, 87 deletions(-) delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 038896b..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "recommendations": [ - "github.vscode-github-actions", - "ms-vscode.powershell" - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e732ea1..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "[json]": { - "editor.defaultFormatter": "vscode.json-language-features" - }, - "[jsonc]": { - "editor.defaultFormatter": "vscode.json-language-features" - }, - "[markdown]": { - "editor.defaultFormatter": "yzhang.markdown-all-in-one", - "editor.quickSuggestions": { - "comments": "off", - "other": "off", - "strings": "off" - }, - "editor.wordWrap": "off" - }, - "[powershell]": { - "editor.defaultFormatter": "ms-vscode.powershell", - "editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?", - "files.encoding": "utf8bom" - }, - "[yaml]": { - "editor.defaultFormatter": "github.vscode-github-actions", - "editor.insertSpaces": true, - "editor.tabSize": 2, - }, - "[github-actions-workflow]": { - "editor.defaultFormatter": "github.vscode-github-actions", - "editor.insertSpaces": true, - "editor.tabSize": 2 - }, - "editor.rulers": [0, 150], - "powershell.codeFormatting.autoCorrectAliases": true, - "powershell.codeFormatting.newLineAfterCloseBrace": false, - "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", - "powershell.codeFormatting.preset": "OTBS", - "powershell.codeFormatting.trimWhitespaceAroundPipe": true, - "powershell.codeFormatting.useConstantStrings": true, - "powershell.codeFormatting.useCorrectCasing": true, - "powershell.codeFormatting.whitespaceBetweenParameters": true, - "powershell.pester.codeLens": false, - "powershell.powerShellDefaultVersion": "PowerShell (x64)", - "powershell.scriptAnalysis.enable": true, - "todo-tree.general.tags": [ - "BUG", - "HACK", - "FIXME", - "TODO", - "DEBUG" - ], - "todo-tree.highlights.customHighlight": { - "TODO": { - "background": "#00ff00", - "foreground": "#ffffff", - "icon": "alert", - "iconColour": "#00ff00", - "type": "text-and-comment" - }, - "HACK": { - "background": "#ff0000", - "foreground": "#ffffff", - "icon": "alert", - "iconColour": "#ff0000", - "type": "text-and-comment" - }, - "FIXME": { - "background": "#ff0000", - "foreground": "#ffffff", - "icon": "alert", - "iconColour": "#ff0000", - "type": "text-and-comment" - }, - "BUG": { - "background": "#ff0000", - "foreground": "#ffffff", - "icon": "alert", - "iconColour": "#ff0000", - "type": "text-and-comment" - } - } -}