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
105 changes: 105 additions & 0 deletions .github/workflows/changelog-verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Changelog verification
on:
pull_request:
branches: ["**"]
push:
branches: ["master"]

permissions:
contents: read

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Check for entry in changelog.d changes in the PR
run: |
set -x

# Set BASE_SHA and HEAD_SHA based on event type
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE_SHA=${{ github.event.pull_request.base.sha }}
HEAD_SHA=${{ github.event.pull_request.head.sha }}

# Use 3-dot syntax so we only see changes introduced by this PR
CHANGED_FILES=$(git diff --name-status "$BASE_SHA...$HEAD_SHA" -- changelog.d/ | awk '$1 ~ /^[AM]/ {print $2}' || true)
DELETED_FILES=$(git diff --name-status "$BASE_SHA...$HEAD_SHA" -- changelog.d/ | awk '$1 ~ /^D/ {print $2}' || true)
CHANGELOG_MODIFIED=$(git diff --name-only "$BASE_SHA...$HEAD_SHA" -- CHANGELOG.md | grep -vE "^$" || true)
else
# For push events, compare with the previous commit
HEAD_SHA=${{ github.sha }}
BASE_SHA=$(git rev-parse HEAD~1)
CHANGED_FILES=$(git diff --name-status "$BASE_SHA" "$HEAD_SHA" -- changelog.d/ | awk '$1 ~ /^[AM]/ {print $2}' || true)
DELETED_FILES=$(git diff --name-status "$BASE_SHA" "$HEAD_SHA" -- changelog.d/ | awk '$1 ~ /^D/ {print $2}' || true)
CHANGELOG_MODIFIED=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" -- CHANGELOG.md | grep -vE "^$" || true)
fi

echo "BASE_SHA: $BASE_SHA"
echo "HEAD_SHA: $HEAD_SHA"
echo "CHANGELOG_MODIFIED: ${CHANGELOG_MODIFIED:-false}"
echo "CHANGED_FILES:"
echo "$CHANGED_FILES"
if [ -n "$DELETED_FILES" ]; then
echo "DELETED_CHANGELOG_FILES:"
echo "$DELETED_FILES"
fi

# Check if commit is by zebot with wire-build update message
COMMIT_AUTHOR=$(git log --format="%an" -1 $HEAD_SHA)
COMMIT_MESSAGE=$(git log --format="%s" -1 $HEAD_SHA)

if [[ "$COMMIT_AUTHOR" == "Zebot" && "$COMMIT_MESSAGE" == "Update wire-build to version"* ]]; then
echo "Skipping changelog check for zebot wire-build update commit"
echo "Author: $COMMIT_AUTHOR"
echo "Message: $COMMIT_MESSAGE"
exit 0
fi

PATTERN='^(Added|Changed|Deprecated|Removed|Fixed|Security): .+'
LINE_FOUND=false
ALLOW_RELEASE_CLEANUP=false

if [ -z "$CHANGED_FILES" ]; then
if [ -n "$CHANGELOG_MODIFIED" ]; then
if [ -n "$DELETED_FILES" ]; then
echo "Release detected via CHANGELOG.md update; deleted changelog.d/ entries are allowed."
else
echo "Release detected via CHANGELOG.md update; no changelog.d/ deletions found in this compare range."
fi
ALLOW_RELEASE_CLEANUP=true
else
echo "No files changed in changelog.d/ for this ${GITHUB_EVENT_NAME:-event}."
echo "Every PR must add or modify at least one changelog.d/ entry."
exit 1
fi
fi

for file in $CHANGED_FILES; do
if [ ! -f "$file" ]; then
echo "Skipping missing changelog file: $file"
continue
fi
while IFS= read -r line; do
if [[ -z "$line" ]]; then
continue
fi
if echo "$line" | grep -qE "$PATTERN"; then
LINE_FOUND=true
echo "Valid pattern found in file $file: '$line'"
else
echo "Invalid format in file $file: '$line'"
exit 1
fi
done < "$file"
done

if [ "$LINE_FOUND" = false ] && [ "$ALLOW_RELEASE_CLEANUP" = false ]; then
echo "No valid lines found in changelog.d/ files. Ensure there is a newline at the end of files."
echo "Please read more policies about changelog at https://keepachangelog.com/en/1.1.0"
exit 1
fi
72 changes: 0 additions & 72 deletions .github/workflows/custom-artifact.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/deploy-wiab.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/offline-min.yml

This file was deleted.

Loading
Loading