Skip to content

Commit 2869adb

Browse files
authored
Merge pull request #131 from danbaruka/changelog-setup-config-clean
feat: Add automated changelog generation
2 parents 2056741 + 3004705 commit 2869adb

File tree

4 files changed

+336
-8
lines changed

4 files changed

+336
-8
lines changed

.github/workflows/changelog.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Update Changelog on Tag
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on tags starting with 'v' (e.g., v2.1.2)
7+
- '[0-9]+.[0-9]+.[0-9]+' # Also triggers on semantic version tags (e.g., 2.1.2)
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
update-changelog:
14+
name: Regenerate Changelog
15+
runs-on: ubuntu-latest
16+
# Skip if the commit message indicates standard-version already ran
17+
if: ${{ github.event.head_commit.message && !contains(github.event.head_commit.message, 'chore(release)') }}
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
cache: 'npm'
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Configure Git
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "github-actions[bot]@users.noreply.github.com"
39+
40+
- name: Verify changelog is up to date
41+
run: |
42+
# This workflow ensures changelog is updated when tags are manually created
43+
# If standard-version was used, the changelog should already be updated
44+
echo "Tag ${{ github.ref_name }} was pushed. Verifying changelog is up to date."
45+
46+
# Check if CHANGELOG.md contains the current tag
47+
if grep -q "${{ github.ref_name }}" CHANGELOG.md; then
48+
echo "Changelog already contains this tag version."
49+
else
50+
echo "Warning: Changelog may not contain this tag version."
51+
echo "Consider running 'npm run release' to generate changelog before creating tags."
52+
fi
53+

.versionrc.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"changelogFile": "CHANGELOG.md",
3+
"infile": "CHANGELOG.md",
4+
"header": "# Developer Experience Working Group Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n",
5+
"releaseCommitMessageFormat": "chore(release): {{currentTag}}",
6+
"types": [
7+
{
8+
"type": "feat",
9+
"section": "Added"
10+
},
11+
{
12+
"type": "fix",
13+
"section": "Fixed"
14+
},
15+
{
16+
"type": "docs",
17+
"section": "Documentation"
18+
},
19+
{
20+
"type": "style",
21+
"hidden": true
22+
},
23+
{
24+
"type": "refactor",
25+
"section": "Changed"
26+
},
27+
{
28+
"type": "perf",
29+
"section": "Performance"
30+
},
31+
{
32+
"type": "test",
33+
"hidden": true
34+
},
35+
{
36+
"type": "chore",
37+
"hidden": true
38+
}
39+
],
40+
"skip": {
41+
"tag": false
42+
}
43+
}

CHANGELOG.md

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,75 @@
11
# Developer Experience Working Group Changelog
22

3-
TODO: add informative comment to explain how to track the state of the working group.
3+
All notable changes to this project will be documented in this file.
44

5-
## 2.1.1 - January 2025
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

7-
### Changes
8+
## [2.2.0] - 2025-12-20
9+
10+
### Added
11+
12+
* add Meetup Reminder Button with dynamic session management ([7ae9176](https://github.com/danbaruka/developer-experience/commit/7ae91768f0c7b63ac7f29c49de55c52879419d6b))
13+
* complete homepage redesign with Intersect MBO branding ([f2349cf](https://github.com/danbaruka/developer-experience/commit/f2349cf27aca0168db791d1bcd5e196b60f599d7)), closes [#0128](https://github.com/danbaruka/developer-experience/issues/0128)
14+
15+
### Changed
16+
17+
* reduce homepage contents for better UX ([d9c3f20](https://github.com/danbaruka/developer-experience/commit/d9c3f20064e3df4816911d0a50652c1030fcf94d)), closes [#f55521](https://github.com/danbaruka/developer-experience/issues/f55521)
18+
19+
### Fixed
20+
21+
* configure GitHub Actions as Pages publishing source ([3f7204e](https://github.com/danbaruka/developer-experience/commit/3f7204e83ad8a86f3304933b02745b19e5627ee3))
22+
* config file / baseUrl and build issue ([0e235e4](https://github.com/danbaruka/developer-experience/commit/0e235e4e385176d39fe660f405321d30cffb2fba))
23+
* resolve broken links and restore strict validation for successful build ([1e83067](https://github.com/danbaruka/developer-experience/commit/1e83067f4a91f7f5beae6695a4cd94717a4d0c21))
24+
* update production URL and resolve all build warnings ([02761d5](https://github.com/danbaruka/developer-experience/commit/02761d5cffe59bb420b332777283780287cf97a9)), closes [#65](https://github.com/danbaruka/developer-experience/issues/65)
25+
* resolve broken anchor links and remove advanced README ([65a0d3c](https://github.com/danbaruka/developer-experience/commit/65a0d3c3378a26fb8b7cd238ca631aee5cdef4ac))
26+
* ensure active sidebar menu items display in blue ([54934f5](https://github.com/danbaruka/developer-experience/commit/54934f5b8dca58fedc0a3c6744c109d9769cd94f)), closes [#0128](https://github.com/danbaruka/developer-experience/issues/0128)
27+
* improve navbar and footer accessibility colors ([d1a84b3](https://github.com/danbaruka/developer-experience/commit/d1a84b39f5a18e17662f62c829d6229f212a0c9e))
28+
* **nav:** force theme toggle icon to white across themes ([9a90644](https://github.com/danbaruka/developer-experience/commit/9a9064430636159ae14e0becadc67f1439228136))
29+
* revise security.md ([a50b435](https://github.com/danbaruka/developer-experience/commit/a50b43522c3a27fdb5dfe66750e0a494213419e6))
30+
* update issue template links and remove working group update template ([43dd21c](https://github.com/danbaruka/developer-experience/commit/43dd21caa83b40e8641faa297af984bb45b44889))
31+
* update issue template links to point to repo CONTRIBUTING.md and Intersect membership ([b760e95](https://github.com/danbaruka/developer-experience/commit/b760e950236d628a1e5ef9566a840720a80ca70a))
32+
* update README with project website link ([75eed1a](https://github.com/danbaruka/developer-experience/commit/75eed1a2a6e8c4cc4a7f022f59b0e52d2404fd09))
33+
* updated contributing.md ([2f60085](https://github.com/danbaruka/developer-experience/commit/2f60085ca4f7302857f98e74c0505e344609ac4e))
34+
35+
### Documentation
36+
37+
* add Cardano ecosystem kickoff & orientation guide ([aafd86d](https://github.com/danbaruka/developer-experience/commit/aafd86d48ed1d91eada8323fb2524f188b9c861f))
38+
* add Cardano ecosystem kickoff & orientation guide ([8eb7e41](https://github.com/danbaruka/developer-experience/commit/8eb7e411ab636b8eb23c27d202cd8e9a10fd44cb))
39+
* Add cardano-api repository documentation ([317df18](https://github.com/danbaruka/developer-experience/commit/317df184bc0d19969fc28deac658d33bd3113f92))
40+
* add cardano-db-sync documentation ([cc6e232](https://github.com/danbaruka/developer-experience/commit/cc6e232ad033e3ba8265f320425b2711abf61029))
41+
* **env:** refine Cardano Dev Environment doc; add wallets section; clarify node/CLI vs APIs; link to kickoff anchors and official node install (incl. Nix) ([5ae78ed](https://github.com/danbaruka/developer-experience/commit/5ae78ed4d5cbb03a328788be02af6d5658722aaa))
42+
* **kickoff:** clean up kickoff session docs; remove deprecated directive-kickoff.md; refine orientation readme ([bf4139b](https://github.com/danbaruka/developer-experience/commit/bf4139b13e546de3d6ecb5193282fc805099244d))
43+
* **kickoff:** restore 01-kickoff-orientation from upstream ([93e641b](https://github.com/danbaruka/developer-experience/commit/93e641bf762a673e2edd63ea4f76b1eb09a0aaa4))
44+
* **session-03:** add overview page ([6cf522c](https://github.com/danbaruka/developer-experience/commit/6cf522c4933cafa053244efe6eec5e0275baf0fa))
45+
* **session-03:** add recording page ([93fd12e](https://github.com/danbaruka/developer-experience/commit/93fd12e1b3994aeafa01936722842e769b4956f6))
46+
* **session-03:** add resources page ([bc4c7d5](https://github.com/danbaruka/developer-experience/commit/bc4c7d5efaf006c1c6014c87230b277545faae2e))
47+
* **session-03:** expose section in sidebar ([e55e7a2](https://github.com/danbaruka/developer-experience/commit/e55e7a2a52fca4d70f7581e28b8bad83613e8536))
48+
* Update cardano-api documentation structure ([2489726](https://github.com/danbaruka/developer-experience/commit/24897262d1f0d9b966b0a8362a0a4aacec028d38))
49+
* **wg-sessions:** Update Session 06 to Repository Walkthrough & add recordings ([79475d0](https://github.com/danbaruka/developer-experience/commit/79475d0c7d4e3799f3672e8426e6349d791eb8b9))
50+
51+
## [2.1.1] - 2025-01-01
52+
53+
### Added
854

955
- github repo created
1056

11-
## 2.1.0 - August 2024
57+
## [2.1.0] - 2024-08-01
1258

13-
### Changes
59+
### Added
1460

1561
- Developer Advocate Program was kicked off
1662

17-
## 2.0.0
63+
## [2.0.0] - 2024-01-01
1864

19-
### Changes
65+
### Changed
2066

2167
- ownership of developer experience went from IOG to Intersect MBO
2268

23-
## 1.0.0
69+
## [1.0.0] - 2023-01-01
70+
71+
### Added
72+
73+
- Initial release
2474

2575
[See Github](https://github.com/input-output-hk/Developer-Experience-working-group)

scripts/changelog-dates.js

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Generate a changelog between two dates
5+
* Usage: node scripts/changelog-dates.js --from YYYY-MM-DD --to YYYY-MM-DD
6+
*/
7+
8+
const { execSync } = require('child_process');
9+
const { argv } = require('process');
10+
11+
// Parse command line arguments
12+
function parseArgs() {
13+
const args = {};
14+
for (let i = 2; i < argv.length; i++) {
15+
if (argv[i] === '--from' && argv[i + 1]) {
16+
args.from = argv[i + 1];
17+
i++;
18+
} else if (argv[i] === '--to' && argv[i + 1]) {
19+
args.to = argv[i + 1];
20+
i++;
21+
}
22+
}
23+
return args;
24+
}
25+
26+
// Validate date format (YYYY-MM-DD)
27+
function isValidDate(dateString) {
28+
const regex = /^\d{4}-\d{2}-\d{2}$/;
29+
if (!regex.test(dateString)) return false;
30+
const date = new Date(dateString);
31+
return date instanceof Date && !isNaN(date);
32+
}
33+
34+
// Get commits between two dates
35+
function getCommits(fromDate, toDate) {
36+
try {
37+
const since = `${fromDate} 00:00:00`;
38+
const until = `${toDate} 23:59:59`;
39+
const command = `git log --since="${since}" --until="${until}" --pretty=format:"%h|%s|%an|%ad" --date=short`;
40+
const output = execSync(command, { encoding: 'utf-8' });
41+
return output.trim().split('\n').filter(line => line.length > 0);
42+
} catch (error) {
43+
return [];
44+
}
45+
}
46+
47+
// Categorize commit by conventional commit type
48+
function categorizeCommit(message) {
49+
const types = {
50+
feat: 'Added',
51+
fix: 'Fixed',
52+
docs: 'Documentation',
53+
style: 'Style',
54+
refactor: 'Changed',
55+
perf: 'Performance',
56+
test: 'Tests',
57+
chore: 'Chore',
58+
build: 'Build',
59+
ci: 'CI'
60+
};
61+
62+
for (const [type, category] of Object.entries(types)) {
63+
if (message.toLowerCase().startsWith(`${type}:`)) {
64+
return category;
65+
}
66+
if (message.toLowerCase().startsWith(`${type}(`)) {
67+
return category;
68+
}
69+
}
70+
71+
// Check for breaking changes
72+
if (message.includes('BREAKING CHANGE') || message.includes('!:')) {
73+
return 'Breaking Changes';
74+
}
75+
76+
return 'Other';
77+
}
78+
79+
// Format commits into changelog sections
80+
function formatChangelog(commits, fromDate, toDate) {
81+
const categorized = {};
82+
83+
commits.forEach(line => {
84+
const [hash, message, author, date] = line.split('|');
85+
const category = categorizeCommit(message);
86+
87+
if (!categorized[category]) {
88+
categorized[category] = [];
89+
}
90+
91+
// Clean up message (remove type prefix)
92+
let cleanMessage = message;
93+
const match = message.match(/^[^:)]+[):]\s*(.+)/);
94+
if (match) {
95+
cleanMessage = match[1].trim();
96+
}
97+
98+
categorized[category].push({
99+
hash: hash.substring(0, 7),
100+
message: cleanMessage,
101+
author,
102+
date
103+
});
104+
});
105+
106+
// Build changelog output
107+
let output = `# Changelog: ${fromDate} to ${toDate}\n\n`;
108+
output += `Generated changelog for the period between ${fromDate} and ${toDate}.\n\n`;
109+
110+
const order = [
111+
'Breaking Changes',
112+
'Added',
113+
'Fixed',
114+
'Changed',
115+
'Performance',
116+
'Documentation',
117+
'Build',
118+
'CI',
119+
'Tests',
120+
'Style',
121+
'Chore',
122+
'Other'
123+
];
124+
125+
order.forEach(category => {
126+
if (categorized[category] && categorized[category].length > 0) {
127+
output += `## ${category}\n\n`;
128+
categorized[category].forEach(commit => {
129+
output += `- ${commit.message} (${commit.hash}) - ${commit.author}\n`;
130+
});
131+
output += '\n';
132+
}
133+
});
134+
135+
// Summary
136+
const total = commits.length;
137+
output += `---\n\n**Total commits:** ${total}\n`;
138+
output += `**Period:** ${fromDate} to ${toDate}\n`;
139+
140+
return output;
141+
}
142+
143+
// Main execution
144+
function main() {
145+
const args = parseArgs();
146+
147+
if (!args.from || !args.to) {
148+
console.error('Usage: node scripts/changelog-dates.js --from YYYY-MM-DD --to YYYY-MM-DD');
149+
console.error('Example: node scripts/changelog-dates.js --from 2025-01-01 --to 2025-01-31');
150+
process.exit(1);
151+
}
152+
153+
if (!isValidDate(args.from)) {
154+
console.error(`Invalid date format for --from: ${args.from}`);
155+
console.error('Expected format: YYYY-MM-DD (e.g., 2025-01-01)');
156+
process.exit(1);
157+
}
158+
159+
if (!isValidDate(args.to)) {
160+
console.error(`Invalid date format for --to: ${args.to}`);
161+
console.error('Expected format: YYYY-MM-DD (e.g., 2025-01-31)');
162+
process.exit(1);
163+
}
164+
165+
if (new Date(args.from) > new Date(args.to)) {
166+
console.error('Error: --from date must be before --to date');
167+
process.exit(1);
168+
}
169+
170+
const commits = getCommits(args.from, args.to);
171+
172+
if (commits.length === 0) {
173+
console.log(`No commits found between ${args.from} and ${args.to}`);
174+
process.exit(0);
175+
}
176+
177+
const changelog = formatChangelog(commits, args.from, args.to);
178+
console.log(changelog);
179+
}
180+
181+
main();
182+

0 commit comments

Comments
 (0)