Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* text=auto
.gitattributes text eol=lf
*.md text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.json text eol=lf
*.sh text eol=lf
*.ps1 text eol=lf
*.txt text eol=lf
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 错误反馈
description: 反馈手册中的错误命令、错误说明或过时内容
title: "[错误反馈] "
labels: ["bug", "documentation"]
body:
- type: textarea
id: location
attributes:
label: 问题位置
description: 请粘贴章节标题、链接或相关命令。
validations:
required: true
- type: textarea
id: problem
attributes:
label: 具体问题
description: 请描述哪里不正确,以及你的系统环境。
validations:
required: true
- type: textarea
id: expected
attributes:
label: 建议修正
description: 如果你知道正确写法,可以直接贴出来。
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/command-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 命令补充
description: 建议补充一个命令或场景
title: "[命令补充] "
labels: ["documentation", "command-request"]
body:
- type: dropdown
id: platform
attributes:
label: 适用平台
options:
- Windows PowerShell
- Linux
- 银河麒麟
- 统信 UOS
- 跨平台
validations:
required: true
- type: textarea
id: command
attributes:
label: 命令或场景
description: 请写出命令、使用场景和期望补充的位置。
placeholder: 例如: 查看 8080 端口占用并结束进程
validations:
required: true
- type: textarea
id: notes
attributes:
label: 补充说明
description: 如果命令有风险、版本限制或依赖工具,请一并说明。
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: 阅读贡献指南
url: https://github.com/shiwenxin123/PowerShell-Linux-/blob/main/CONTRIBUTING.md
about: 提交 Issue 或 PR 前建议先阅读贡献指南。
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/troubleshooting-case.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 故障案例补充
description: 建议补充一个真实运维故障案例
title: "[故障案例] "
labels: ["documentation", "troubleshooting"]
body:
- type: textarea
id: symptom
attributes:
label: 故障现象
description: 请描述用户看到的现象、报错或告警。
placeholder: 例如: Grafana 面板显示 No data,Prometheus target 为 down
validations:
required: true
- type: textarea
id: environment
attributes:
label: 环境信息
description: 请说明系统、组件、版本或部署方式。
placeholder: 例如: Kubernetes 1.28、Prometheus Operator、Nginx 1.24
- type: textarea
id: checks
attributes:
label: 已尝试排查
description: 请列出已经执行过的命令、日志或排查结论。
- type: textarea
id: expected
attributes:
label: 期望补充内容
description: 请说明希望文档补充哪些命令、处理建议或风险提醒。
33 changes: 33 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- name: documentation
color: "0075ca"
description: 文档新增或修改
- name: command-request
color: "0e8a16"
description: 新命令或新场景建议
- name: bug
color: "d73a4a"
description: 错误命令、错误说明或过时内容
- name: good first issue
color: "7057ff"
description: 适合第一次贡献
- name: help wanted
color: "008672"
description: 欢迎社区协助
- name: security
color: "b60205"
description: 高危命令或安全风险
- name: powershell
color: "012456"
description: PowerShell 相关内容
- name: linux
color: "f0db4f"
description: Linux 相关内容
- name: kylin
color: "c5def5"
description: 银河麒麟相关内容
- name: uos
color: "bfdadc"
description: 统信 UOS 相关内容
- name: containers
color: "1d76db"
description: Docker 或 Kubernetes 相关内容
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## 变更内容

-

## 变更类型

- [ ] 修正文档错误
- [ ] 补充命令
- [ ] 新增专题
- [ ] 改进示例脚本
- [ ] 其他

## 检查清单

- [ ] 命令已在对应环境验证,或已注明版本限制
- [ ] 高危命令已标注风险
- [ ] 未包含真实密码、Token、内网地址等敏感信息
- [ ] Markdown 表格和代码块可以正常渲染
54 changes: 54 additions & 0 deletions .github/workflows/docs-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docs Site

on:
push:
branches:
- main
- master
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install MkDocs
run: pip install -r requirements.txt

- name: Build site
run: mkdocs build --strict

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
30 changes: 30 additions & 0 deletions .github/workflows/markdown-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Markdown Check

on:
pull_request:
push:
branches:
- main
- master

jobs:
markdown-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run documentation checks
shell: pwsh
run: ./scripts/check-docs.ps1

markdownlint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run markdownlint
uses: DavidAnson/markdownlint-cli2-action@v17
with:
globs: "**/*.md"
104 changes: 104 additions & 0 deletions .github/workflows/script-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Script Quality

on:
pull_request:
push:
branches:
- main
- master

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: ./scripts

psscriptanalyzer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PSScriptAnalyzer
shell: pwsh
run: Install-Module PSScriptAnalyzer -Force -Scope CurrentUser

- name: Run PSScriptAnalyzer
shell: pwsh
run: Invoke-ScriptAnalyzer -Path ./scripts -Recurse -Severity Warning,Error

linux-health-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Validate JSON schema file
run: python -m json.tool docs/schema/health-check-report.schema.json > /dev/null

- name: Check Bash syntax
run: bash -n scripts/linux-health-check.sh

- name: Validate JSON output
run: |
bash scripts/linux-health-check.sh --module system --format json > linux-health-check.json
python -m json.tool linux-health-check.json > /dev/null

- name: Validate output file
run: |
bash scripts/linux-health-check.sh --module disk --format json --output reports/linux-health-check.json > /dev/null
test -s reports/linux-health-check.json
python -m json.tool reports/linux-health-check.json > /dev/null

- name: Validate parameter exit code
run: |
set +e
bash scripts/linux-health-check.sh --format invalid
code=$?
set -e
test "$code" -eq 2

windows-health-check:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check PowerShell syntax
shell: pwsh
run: |
$parseErrors = $null
[System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw 'scripts/windows-health-check.ps1'), [ref]$parseErrors) | Out-Null
if ($parseErrors) {
$parseErrors | Format-List | Out-String | Write-Error
exit 1
}

- name: Validate JSON output
shell: pwsh
run: |
$json = ./scripts/windows-health-check.ps1 -Module process -Format json | ConvertFrom-Json
if ($json.metadata.format -ne 'json') { throw 'Unexpected metadata.format' }
if (-not $json.modules.process) { throw 'Missing process module' }

- name: Validate output file
shell: pwsh
run: |
./scripts/windows-health-check.ps1 -Module process -Format json -OutputFile reports/windows-health-check.json | Out-Null
$json = Get-Content -Raw reports/windows-health-check.json | ConvertFrom-Json
if ($json.metadata.script -ne 'windows-health-check.ps1') { throw 'Unexpected script metadata' }

- name: Validate parameter exit code
shell: pwsh
run: |
pwsh -NoProfile -ExecutionPolicy Bypass -File ./scripts/windows-health-check.ps1 -Format invalid
if ($LASTEXITCODE -ne 2) {
throw "Expected exit code 2, got $LASTEXITCODE"
}
exit 0
22 changes: 22 additions & 0 deletions .github/workflows/secret-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Secret Scan

on:
pull_request:
push:
branches:
- main
- master

jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# OS / editor
.DS_Store
Thumbs.db
.idea/
.vscode/

# Temporary files
*.tmp
*.bak
*.swp

# Logs
*.log

# Generated reports
reports/

# MkDocs build output
site/
6 changes: 6 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
default: true
MD013: false
MD033: false
MD041: false
MD024:
siblings_only: true
Loading
Loading