Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e5d26d

Browse files
EdwardAngertclaude
andcommitted
feat: enhance docs-ci workflow with security and metrics
- Update workflow description to mention security features- Add throttling and performance parameters to docs-analysis- Add detailed image metrics to job summary- Add most changed file information to reports- Add performance metrics section to job summary- Add execution time reporting from composite action🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
1 parentea54314 commit2e5d26d

File tree

1 file changed

+122
-2
lines changed

1 file changed

+122
-2
lines changed

‎.github/workflows/docs-ci.yaml‎

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name:Docs CI
22

3+
# This workflow runs linting and formatting checks on documentation files.
4+
# It leverages the shared docs-analysis composite action for detecting changes
5+
# and integrates with other documentation workflows through shared outputs.
6+
# Security features ensure safe handling of files and commands.
7+
38
on:
49
push:
510
branches:
@@ -8,22 +13,38 @@ on:
813
-"docs/**"
914
-"**.md"
1015
-".github/workflows/docs-ci.yaml"
16+
-".github/actions/docs-analysis/**"
1117

1218
pull_request:
1319
paths:
1420
-"docs/**"
1521
-"**.md"
1622
-".github/workflows/docs-ci.yaml"
23+
-".github/actions/docs-analysis/**"
1724

1825
permissions:
1926
contents:read
2027

2128
jobs:
2229
docs:
2330
runs-on:ubuntu-latest
31+
outputs:
32+
docs_changed:${{ steps.docs-analysis.outputs.docs-changed }}
33+
docs_files_count:${{ steps.docs-analysis.outputs.docs-files-count }}
34+
words_added:${{ steps.docs-analysis.outputs.words-added }}
35+
words_removed:${{ steps.docs-analysis.outputs.words-removed }}
36+
images_changed:${{ steps.docs-analysis.outputs.images-total }}
37+
significant_change:${{ steps.docs-analysis.outputs.significant-change }}
2438
steps:
39+
-name:Harden Runner
40+
uses:step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481# v2.11.0
41+
with:
42+
egress-policy:audit
43+
2544
-name:Checkout
2645
uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2
46+
with:
47+
fetch-depth:50# Increased for better detection of doc changes
2748

2849
-name:Setup Node
2950
uses:./.github/actions/setup-node
@@ -35,14 +56,113 @@ jobs:
3556
docs/**
3657
**.md
3758
separator:","
59+
fetch_depth:50
60+
since_last_remote_commit:${{ github.event_name == 'push' }}
61+
62+
# Use our composite action to analyze documentation changes
63+
-name:Analyze documentation changes
64+
id:docs-analysis
65+
uses:./.github/actions/docs-analysis
66+
with:
67+
docs-path:"docs/"
68+
changed-files:${{ steps.changed-files.outputs.all_changed_files }}
69+
files-pattern:"docs/**|**.md"
70+
debug-mode:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug == 'true' || 'false' }}
71+
# Enable throttling for large repositories
72+
throttle-large-repos:'true'
73+
# Default performance optimization values
74+
max-scan-files:'100'
75+
max-files-to-analyze:'20'
3876

3977
-name:lint
40-
if:steps.changed-files.outputs.any_changed == 'true'
78+
if:steps.docs-analysis.outputs.docs-changed == 'true'
4179
run:|
4280
pnpm exec markdownlint-cli2 ${{ steps.changed-files.outputs.all_changed_files }}
4381
4482
-name:fmt
45-
if:steps.changed-files.outputs.any_changed == 'true'
83+
if:steps.docs-analysis.outputs.docs-changed == 'true'
4684
run:|
4785
# markdown-table-formatter requires a space separated list of files
4886
echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ',' '\n' | pnpm exec markdown-table-formatter --check
87+
88+
# Display metrics about documentation changes (only on PRs)
89+
-name:Documentation metrics summary
90+
if:github.event_name == 'pull_request' && steps.docs-analysis.outputs.docs-changed == 'true'
91+
run:|
92+
echo "## Documentation Changes Summary" >> $GITHUB_STEP_SUMMARY
93+
echo "" >> $GITHUB_STEP_SUMMARY
94+
echo "| Metric | Value |" >> $GITHUB_STEP_SUMMARY
95+
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
96+
echo "| Files changed | ${{ steps.docs-analysis.outputs.docs-files-count }} |" >> $GITHUB_STEP_SUMMARY
97+
echo "| Words added | ${{ steps.docs-analysis.outputs.words-added }} |" >> $GITHUB_STEP_SUMMARY
98+
echo "| Words removed | ${{ steps.docs-analysis.outputs.words-removed }} |" >> $GITHUB_STEP_SUMMARY
99+
echo "| Processing time | ${{ steps.docs-analysis.outputs.execution-time }}s |" >> $GITHUB_STEP_SUMMARY
100+
101+
if [[ "${{ steps.docs-analysis.outputs.images-total }}" != "0" ]]; then
102+
echo "| Images changed | ${{ steps.docs-analysis.outputs.images-total }} |" >> $GITHUB_STEP_SUMMARY
103+
104+
# Add more detailed image metrics if available
105+
if [[ "${{ steps.docs-analysis.outputs.images-added }}" != "0" || "${{ steps.docs-analysis.outputs.images-modified }}" != "0" || "${{ steps.docs-analysis.outputs.images-deleted }}" != "0" ]]; then
106+
IMAGES_DETAIL=""
107+
if [[ "${{ steps.docs-analysis.outputs.images-added }}" != "0" ]]; then
108+
IMAGES_DETAIL="${{ steps.docs-analysis.outputs.images-added }} added"
109+
fi
110+
if [[ "${{ steps.docs-analysis.outputs.images-modified }}" != "0" ]]; then
111+
if [[ -n "$IMAGES_DETAIL" ]]; then
112+
IMAGES_DETAIL="$IMAGES_DETAIL, ${{ steps.docs-analysis.outputs.images-modified }} modified"
113+
else
114+
IMAGES_DETAIL="${{ steps.docs-analysis.outputs.images-modified }} modified"
115+
fi
116+
fi
117+
if [[ "${{ steps.docs-analysis.outputs.images-deleted }}" != "0" ]]; then
118+
if [[ -n "$IMAGES_DETAIL" ]]; then
119+
IMAGES_DETAIL="$IMAGES_DETAIL, ${{ steps.docs-analysis.outputs.images-deleted }} deleted"
120+
else
121+
IMAGES_DETAIL="${{ steps.docs-analysis.outputs.images-deleted }} deleted"
122+
fi
123+
fi
124+
echo "| Images detail | $IMAGES_DETAIL |" >> $GITHUB_STEP_SUMMARY
125+
fi
126+
fi
127+
128+
if [[ "${{ steps.docs-analysis.outputs.manifest-changed }}" == "true" ]]; then
129+
echo "| Structure changes | Yes (manifest.json modified) |" >> $GITHUB_STEP_SUMMARY
130+
fi
131+
132+
if [[ "${{ steps.docs-analysis.outputs.format-only }}" == "true" ]]; then
133+
echo "| Format only | Yes (no content changes) |" >> $GITHUB_STEP_SUMMARY
134+
fi
135+
136+
# Add most changed file info if available
137+
if [[ "${{ steps.docs-analysis.outputs.most-changed-file }}" != "" ]]; then
138+
echo "| Most changed file | \`${{ steps.docs-analysis.outputs.most-changed-file }}\` |" >> $GITHUB_STEP_SUMMARY
139+
fi
140+
141+
# Create job summary for GitHub Actions UI
142+
-name:Job status summary
143+
if:always()
144+
run:|
145+
STATUS="${{ job.status }}"
146+
147+
if [[ "$STATUS" == "success" ]]; then
148+
echo "## ✅ Documentation checks passed" >> $GITHUB_STEP_SUMMARY
149+
else
150+
echo "## ❌ Documentation checks failed" >> $GITHUB_STEP_SUMMARY
151+
fi
152+
153+
echo "" >> $GITHUB_STEP_SUMMARY
154+
echo "Ran with:" >> $GITHUB_STEP_SUMMARY
155+
echo "- Docs Analysis version: $(cd .github/actions/docs-analysis && git rev-parse --short HEAD || echo 'unknown')" >> $GITHUB_STEP_SUMMARY
156+
echo "- Event: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
157+
158+
# Output useful links for debugging
159+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
160+
echo "- [View PR](https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }})" >> $GITHUB_STEP_SUMMARY
161+
fi
162+
163+
# Output performance metrics
164+
if [[ -f ".github/temp/docs-analysis-metrics.json" ]]; then
165+
echo "" >> $GITHUB_STEP_SUMMARY
166+
echo "### Performance Metrics" >> $GITHUB_STEP_SUMMARY
167+
echo "$(cat .github/temp/docs-analysis-metrics.json | grep -o '"execution_time": [0-9]*' | cut -d' ' -f2) seconds to analyze documentation" >> $GITHUB_STEP_SUMMARY
168+
fi

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp