Skip to content
Open
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
24 changes: 24 additions & 0 deletions actions/setup-git/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Setup Git"
description: "Configure git user identity for automated commits"

inputs:
user-name:
description: "Git user.name"
required: false
default: "github-actions[bot]"
user-email:
description: "Git user.email"
required: false
default: "github-actions[bot]@users.noreply.github.com"

runs:
using: "composite"
steps:
- name: "Configure git identity"
run: |
git config user.name "$GIT_USER_NAME"
git config user.email "$GIT_USER_EMAIL"
shell: bash
Comment on lines +17 to +21
env:
GIT_USER_NAME: ${{ inputs.user-name }}
GIT_USER_EMAIL: ${{ inputs.user-email }}
150 changes: 150 additions & 0 deletions dist/extract-release-notes.js

Large diffs are not rendered by default.

148 changes: 148 additions & 0 deletions dist/validate-changelog.js

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions src/extract-release-notes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as core from '@actions/core';
import { readFileSync } from 'node:fs';

let changelog: string;

try {
changelog = readFileSync('CHANGELOG.md', 'utf8');
} catch {
core.setFailed('Could not read CHANGELOG.md');
process.exit(1);
}

const lines = changelog.split('\n');
const firstHeader = lines.findIndex((line) => /^## /.test(line));

if (firstHeader === -1) {
core.setFailed('No release section (## heading) found in CHANGELOG.md');
process.exit(1);
}

const secondHeader = lines.findIndex((line, index) => index > firstHeader && /^## /.test(line));

const notes = lines
.slice(firstHeader + 1, secondHeader === -1 ? undefined : secondHeader)
.join('\n')
.trim();
Comment on lines +14 to +26

core.setOutput('release_details', notes);
15 changes: 15 additions & 0 deletions src/validate-changelog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as core from '@actions/core';
import { readFileSync } from 'node:fs';

let changelog: string;

try {
changelog = readFileSync('CHANGELOG.md', 'utf8');
} catch {
core.setFailed('Could not read CHANGELOG.md');
process.exit(1);
}

if (!/##\s+UNRELEASED/i.test(changelog)) {
core.setFailed('UNRELEASED section not found in CHANGELOG.md');
}