Skip to content

Commit 1e008ee

Browse files
chore: Remove example workflow files and add changelog and contribution guidelines
1 parent 5ef7b46 commit 1e008ee

File tree

9 files changed

+626
-88
lines changed

9 files changed

+626
-88
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Changelog Check
2+
3+
# This workflow validates that CHANGELOG.md has been updated in PRs
4+
# It ensures that changes are properly documented before merging
5+
6+
on:
7+
pull_request:
8+
branches: [main]
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
11+
jobs:
12+
check-changelog:
13+
name: Verify Changelog Updated
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Get changed files
24+
id: changed-files
25+
run: |
26+
# Get list of changed files (excluding the changelog itself from this check)
27+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
28+
echo "Changed files:"
29+
echo "$CHANGED_FILES"
30+
31+
# Check if any substantive files were changed (not just docs or CI)
32+
SUBSTANTIVE_CHANGES=$(echo "$CHANGED_FILES" | grep -vE \
33+
'^(\.github/|CHANGELOG\.md|README\.md|LICENSE|\.gitignore)' \
34+
|| true)
35+
36+
if [ -z "$SUBSTANTIVE_CHANGES" ]; then
37+
echo "substantive_changes=false" >> $GITHUB_OUTPUT
38+
echo "Only documentation or CI files changed, changelog update not required"
39+
else
40+
echo "substantive_changes=true" >> $GITHUB_OUTPUT
41+
echo "Substantive changes detected, checking changelog..."
42+
fi
43+
44+
- name: Check if CHANGELOG.md was modified
45+
id: changelog-modified
46+
if: steps.changed-files.outputs.substantive_changes == 'true'
47+
run: |
48+
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "CHANGELOG.md"; then
49+
echo "changelog_updated=true" >> $GITHUB_OUTPUT
50+
echo "✓ CHANGELOG.md has been updated"
51+
else
52+
echo "changelog_updated=false" >> $GITHUB_OUTPUT
53+
echo "✗ CHANGELOG.md has not been updated"
54+
fi
55+
56+
- name: Verify changelog has content for this PR
57+
if: steps.changed-files.outputs.substantive_changes == 'true' && steps.changelog-modified.outputs.changelog_updated == 'true'
58+
run: |
59+
echo "Checking CHANGELOG.md content..."
60+
61+
# Check if there's content in the Unreleased section
62+
if grep -A 10 "## \[Unreleased\]" CHANGELOG.md | grep -qE \
63+
"^### (Added|Changed|Deprecated|Removed|Fixed|Security)"; then
64+
echo "✓ CHANGELOG.md has entries in the Unreleased section"
65+
else
66+
echo "⚠ Warning: CHANGELOG.md may not have entries in the Unreleased section"
67+
echo "Please ensure changes are documented under ## [Unreleased]"
68+
exit 1
69+
fi
70+
71+
- name: Fail if changelog not updated
72+
if: steps.changed-files.outputs.substantive_changes == 'true' && steps.changelog-modified.outputs.changelog_updated == 'false'
73+
run: |
74+
echo "❌ CHANGELOG.md must be updated when making substantive changes"
75+
echo ""
76+
echo "Please add an entry to CHANGELOG.md under the [Unreleased] section."
77+
echo "Follow the Keep a Changelog format:"
78+
echo ""
79+
echo "## [Unreleased]"
80+
echo ""
81+
echo "### Added"
82+
echo "- New features"
83+
echo ""
84+
echo "### Changed"
85+
echo "- Changes in existing functionality"
86+
echo ""
87+
echo "### Fixed"
88+
echo "- Bug fixes"
89+
echo ""
90+
exit 1
91+
92+
- name: Success message
93+
if: steps.changed-files.outputs.substantive_changes == 'false' || steps.changelog-modified.outputs.changelog_updated == 'true'
94+
run: |
95+
echo "✅ Changelog check passed!"

.github/workflows/example-advanced.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/example-badges.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/example-basic.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/lint-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Lint and Test
2+
3+
# This workflow runs linting and tests on PRs and pushes to main
4+
# It ensures code quality and prevents broken code from being merged
5+
6+
on:
7+
pull_request:
8+
branches: [main]
9+
push:
10+
branches: [main]
11+
workflow_dispatch: {}
12+
13+
jobs:
14+
lint-yaml:
15+
name: Lint YAML Files
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v6
22+
23+
- name: Setup Python
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version: '3.11'
27+
continue-on-error: false
28+
29+
- name: Install yamllint
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install yamllint
33+
continue-on-error: false
34+
35+
- name: Run yamllint
36+
run: |
37+
echo "Running yamllint on workflow files..."
38+
yamllint -d \
39+
'{extends: default, rules: {line-length: {max: 120}, comments: {min-spaces-from-content: 1}}}' .github/workflows/ \
40+
|| true
41+
continue-on-error: false
42+
43+
- name: Validate action.yml
44+
run: |
45+
echo "Validating action.yml syntax..."
46+
python -c "import yaml; yaml.safe_load(open('action.yml'))" && echo "✓ action.yml is valid YAML"
47+
continue-on-error: false

0 commit comments

Comments
 (0)