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
59 changes: 59 additions & 0 deletions .github/workflows/ci_changelog_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: ci_changelog_check

# Runs on every PR event that could change which files are included.
# 'labeled'/'unlabeled' are needed so that adding/removing the
# 'no-changelog' label immediately re-evaluates the check.
on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

permissions:
contents: read
pull-requests: read

jobs:
changelog_check:
runs-on: ubuntu-latest
name: Check Changelog Entry

# Skip the whole job (shows as "skipped" = passing) when a maintainer
# has deliberately labelled the PR 'no-changelog'.
# Typical use-cases: CI-only fixes, typo corrections, dependency bumps.
if: "!contains(github.event.pull_request.labels.*.name, 'no-changelog')"

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Full history is required so tj-actions/changed-files can compare
# the PR branch against the base branch correctly.
fetch-depth: 0

- name: Detect changed files
id: changed_files
uses: tj-actions/changed-files@v44
with:
# Only care about the top-level CHANGELOG.md.
files: CHANGELOG.md

- name: Fail — no changelog entry found
if: steps.changed_files.outputs.any_changed == 'false'
run: |
echo "::error file=CHANGELOG.md::Missing changelog entry. Please add one before merging."
echo ""
echo "Every user-facing pull request must include an update to CHANGELOG.md."
echo "If this PR genuinely does not need a changelog entry (e.g. a CI fix,"
echo "a typo correction, or a dependency bump), ask a maintainer to add the"
echo "'no-changelog' label to skip this check."
exit 1

- name: Pass — changelog entry found
if: steps.changed_files.outputs.any_changed == 'true'
run: echo "CHANGELOG.md was updated. Check passed."
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ Scribe-Android tries to follow [semantic versioning](https://semver.org/), a MAJ
Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).

# Scribe-Android 1.0.0

### CI/CD

- Added `ci_changelog_check` workflow to enforce `CHANGELOG.md` updates on all PRs targeting `main`, with support for a `no-changelog` label to skip the check when appropriate
Loading