Skip to content

Commit 80fcddb

Browse files
committed
feat: add context-ledger action for AI-powered changelog generation
0 parents  commit 80fcddb

File tree

16 files changed

+3020
-0
lines changed

16 files changed

+3020
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG] "
5+
labels: "bug"
6+
assignees: ""
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
1. Configure action with '...'
16+
2. Trigger workflow on '....'
17+
3. Check outputs '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Workflow Configuration**
24+
25+
```yaml
26+
# Paste your action configuration here
27+
```
28+
29+
**Action Logs**
30+
31+
```
32+
# Paste relevant action logs here
33+
```
34+
35+
**Repository Information**
36+
37+
- Repository type: [public/private]
38+
- Trigger event: [pull_request/release/workflow_dispatch]
39+
- Base branch: [main/develop/other]
40+
41+
**Additional context**
42+
Add any other context about the problem here.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE] "
5+
labels: "enhancement"
6+
assignees: ""
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Use Case**
19+
Describe your specific use case and how this feature would help.
20+
21+
**Additional context**
22+
Add any other context or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
commit-message:
9+
prefix: "chore"
10+
include: "scope"
11+
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
open-pull-requests-limit: 5
17+
commit-message:
18+
prefix: "ci"
19+
include: "scope"

.github/pull_request_template.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Description
2+
3+
Brief description of the changes in this PR.
4+
5+
## Type of Change
6+
7+
- [ ] Bug fix (non-breaking change which fixes an issue)
8+
- [ ] New feature (non-breaking change which adds functionality)
9+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10+
- [ ] Documentation update
11+
- [ ] Refactoring (no functional changes)
12+
- [ ] Performance improvement
13+
- [ ] Other (please describe):
14+
15+
## Testing
16+
17+
- [ ] Added/updated tests for the changes
18+
- [ ] All tests pass locally
19+
- [ ] Tested with a real repository
20+
- [ ] Manual testing completed
21+
22+
**Test Details:**
23+
Describe how you tested the changes.
24+
25+
## Checklist
26+
27+
- [ ] My code follows the project's style guidelines
28+
- [ ] I have performed a self-review of my own code
29+
- [ ] I have commented my code, particularly in hard-to-understand areas
30+
- [ ] I have made corresponding changes to the documentation
31+
- [ ] My changes generate no new warnings
32+
- [ ] I have added tests that prove my fix is effective or that my feature works
33+
- [ ] New and existing unit tests pass locally with my changes
34+
35+
## Breaking Changes
36+
37+
If this is a breaking change, please describe the impact and migration path for existing users.
38+
39+
## Additional Notes
40+
41+
Any additional information that would be helpful for reviewers.

.github/workflows/test.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Test Claude Changelog Action
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-action:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: "20"
27+
28+
- name: Install dependencies
29+
run: |
30+
cd .
31+
npm install
32+
33+
- name: Test action (dry run without API key)
34+
env:
35+
ANTHROPIC_API_KEY: "test-key-placeholder"
36+
CHANGELOG_PATH: "test-changelog.md"
37+
TARGET: "test"
38+
LATEST_TAG: "v1.0.0"
39+
COMMIT_COUNT: "5"
40+
GITHUB_EVENT_NAME: "push"
41+
VERSION_INCREMENT: "patch"
42+
run: |
43+
# Create test data
44+
echo "abc123|feat: add new feature|test-author|2025-01-20" > recent_commits.txt
45+
echo "def456|fix: resolve bug|test-author|2025-01-20" >> recent_commits.txt
46+
echo "src/app.js" > changed_files.txt
47+
echo "src/utils.js" >> changed_files.txt
48+
49+
# Test script validation (will fail on API call but should validate structure)
50+
node lib/generate-changelog.js || echo "Expected to fail without valid API key"
51+
52+
# Check that the script doesn't crash on file parsing
53+
if [ ! -f changelog_status.txt ]; then
54+
echo "Error: changelog_status.txt was not created"
55+
exit 1
56+
fi
57+
58+
echo "✅ Script structure validation passed"
59+
60+
lint-and-validate:
61+
runs-on: ubuntu-latest
62+
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
67+
- name: Setup Node.js
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: "20"
71+
72+
- name: Install dependencies
73+
run: |
74+
npm install
75+
npm install js-yaml
76+
77+
- name: Validate action.yml
78+
run: |
79+
# Basic YAML validation
80+
node -e "
81+
const yaml = require('js-yaml');
82+
const fs = require('fs');
83+
try {
84+
const doc = yaml.load(fs.readFileSync('action.yml', 'utf8'));
85+
console.log('✅ action.yml is valid YAML');
86+
87+
// Check required fields
88+
if (!doc.name) throw new Error('Missing name field');
89+
if (!doc.description) throw new Error('Missing description field');
90+
if (!doc.runs) throw new Error('Missing runs field');
91+
if (!doc.inputs) throw new Error('Missing inputs field');
92+
if (!doc.outputs) throw new Error('Missing outputs field');
93+
94+
console.log('✅ action.yml has required fields');
95+
} catch (e) {
96+
console.error('❌ action.yml validation failed:', e.message);
97+
process.exit(1);
98+
}
99+
"
100+
101+
- name: Check Node.js syntax
102+
run: |
103+
node -c lib/generate-changelog.js
104+
echo "✅ JavaScript syntax is valid"
105+
106+
integration-test:
107+
runs-on: ubuntu-latest
108+
if: github.event_name == 'workflow_dispatch'
109+
permissions:
110+
contents: write
111+
pull-requests: write
112+
113+
steps:
114+
- name: Checkout
115+
uses: actions/checkout@v4
116+
with:
117+
fetch-depth: 0
118+
119+
- name: Test the action
120+
uses: ./
121+
with:
122+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
123+
changelog_path: "TEST_CHANGELOG.md"
124+
target_name: "integration-test"
125+
auto_commit: false
126+
continue-on-error: true
127+
128+
- name: Check outputs
129+
run: |
130+
echo "Status: ${{ steps.test.outputs.status }}"
131+
echo "Updated: ${{ steps.test.outputs.changelog_updated }}"
132+
echo "Has changes: ${{ steps.test.outputs.has_changes }}"

.gitignore

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Runtime data
8+
pids
9+
*.pid
10+
*.seed
11+
*.pid.lock
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage/
15+
*.lcov
16+
17+
# nyc test coverage
18+
.nyc_output
19+
20+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
21+
.grunt
22+
23+
# Bower dependency directory (https://bower.io/)
24+
bower_components
25+
26+
# node-waf configuration
27+
.lock-wscript
28+
29+
# Compiled binary addons (https://nodejs.org/api/addons.html)
30+
build/Release
31+
32+
# Dependency directories
33+
jspm_packages/
34+
35+
# Optional npm cache directory
36+
.npm
37+
38+
# Optional eslint cache
39+
.eslintcache
40+
41+
# Microbundle cache
42+
.rpt2_cache/
43+
.rts2_cache_cjs/
44+
.rts2_cache_es/
45+
.rts2_cache_umd/
46+
47+
# Optional REPL history
48+
.node_repl_history
49+
50+
# Output of 'npm pack'
51+
*.tgz
52+
53+
# Yarn Integrity file
54+
.yarn-integrity
55+
56+
# dotenv environment variables file
57+
.env
58+
.env.local
59+
.env.development.local
60+
.env.test.local
61+
.env.production.local
62+
63+
# parcel-bundler cache (https://parceljs.org/)
64+
.cache
65+
.parcel-cache
66+
67+
# Next.js build output
68+
.next
69+
70+
# Nuxt.js build / generate output
71+
.nuxt
72+
dist
73+
74+
# Gatsby files
75+
.cache/
76+
public
77+
78+
# Storybook build outputs
79+
.out
80+
.storybook-out
81+
82+
# Temporary folders
83+
tmp/
84+
temp/
85+
86+
# Logs
87+
logs
88+
*.log
89+
90+
# Runtime data
91+
*.tmp
92+
*.temp
93+
94+
# IDE
95+
.vscode/
96+
.idea/
97+
*.swp
98+
*.swo
99+
*~
100+
101+
# OS generated files
102+
.DS_Store
103+
.DS_Store?
104+
._*
105+
.Spotlight-V100
106+
.Trashes
107+
ehthumbs.db
108+
Thumbs.db
109+
110+
# Test files
111+
test-changelog.md
112+
TEST_CHANGELOG.md
113+
recent_commits.txt
114+
changed_files.txt
115+
changelog_status.txt
116+
new_content.txt
117+
version_info.txt

0 commit comments

Comments
 (0)