Skip to content

Commit 00ec187

Browse files
CopilotStarefossen
andauthored
Separate Storybook category in code analysis + monthly auto-update workflow (#327)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Starefossen <968267+Starefossen@users.noreply.github.com> Co-authored-by: Hans Kristian Flaatten <hans@flaatten.org>
1 parent e8e8d03 commit 00ec187

4 files changed

Lines changed: 835 additions & 1 deletion

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Monthly Code Analysis
2+
3+
on:
4+
schedule:
5+
# Run on the 1st of every month at 00:00 UTC
6+
- cron: '0 0 1 * *'
7+
workflow_dispatch: # Allow manual triggering
8+
9+
jobs:
10+
update-code-analysis:
11+
name: Update Code Analysis
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 15
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '24'
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v4
29+
with:
30+
version: 10.24.0
31+
32+
- name: Get pnpm store directory
33+
shell: bash
34+
run: |
35+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
36+
37+
- name: Setup pnpm cache
38+
uses: actions/cache@v4
39+
with:
40+
path: ${{ env.STORE_PATH }}
41+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
42+
restore-keys: |
43+
${{ runner.os }}-pnpm-store-
44+
45+
- name: Install dependencies
46+
run: pnpm install --frozen-lockfile
47+
48+
- name: Run code analysis
49+
run: pnpm run analyze-code
50+
51+
- name: Get current date
52+
id: date
53+
run: echo "date=$(date +'%B %d, %Y')" >> $GITHUB_OUTPUT
54+
55+
- name: Update CODE_ANALYSIS.md with current date
56+
run: |
57+
# Update the generation date in the document
58+
sed -i "s/\*\*Generated:\*\* .*/\*\*Generated:\*\* ${{ steps.date.outputs.date }}/" docs/CODE_ANALYSIS.md
59+
60+
- name: Check for changes
61+
id: git-check
62+
run: |
63+
git diff --exit-code docs/CODE_ANALYSIS.md || echo "changed=true" >> $GITHUB_OUTPUT
64+
65+
- name: Create Pull Request
66+
if: steps.git-check.outputs.changed == 'true'
67+
uses: peter-evans/create-pull-request@v6
68+
with:
69+
token: ${{ secrets.GITHUB_TOKEN }}
70+
commit-message: 'docs: update monthly code analysis (${{ steps.date.outputs.date }})'
71+
title: 'Monthly Code Analysis Update - ${{ steps.date.outputs.date }}'
72+
body: |
73+
## 📊 Automated Monthly Code Analysis Update
74+
75+
This PR contains the automated monthly update of the code analysis report.
76+
77+
### Changes
78+
- Updated `docs/CODE_ANALYSIS.md` with current codebase statistics
79+
- Analysis run date: ${{ steps.date.outputs.date }}
80+
81+
### Review
82+
Please review the changes to ensure:
83+
- Statistics look reasonable compared to previous month
84+
- New categories or significant shifts are expected
85+
- Documentation accurately reflects the current state
86+
87+
---
88+
*This PR was automatically generated by the Monthly Code Analysis workflow.*
89+
branch: automated/code-analysis-update
90+
delete-branch: true
91+
labels: |
92+
documentation
93+
automated

0 commit comments

Comments
 (0)