Skip to content

Added: Changelog Feature #15

Added: Changelog Feature

Added: Changelog Feature #15

Workflow file for this run

name: Pull Request Title Check
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
validate-pull-request-title:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Validate Pull Request Title
run: |
PR_TITLE=$(jq -r ".pull_request.title" "$GITHUB_EVENT_PATH")
# Check if the pull request title matches the required format
if ! echo "$PR_TITLE" | grep -qE '^(Added|Changed|Deprecated|Removed|Fixed|Security): .+$'; then
echo "Pull request title '$PR_TITLE' does not match the required format."
echo "::error::Pull request title does not match the required format."
exit 1
fi
- name: Extract Changelog Entry
id: extract_changelog_entry
run: |
PR_TITLE=$(jq -r ".pull_request.title" "$GITHUB_EVENT_PATH")
CATEGORY=$(echo "$PR_TITLE" | cut -d ':' -f 1)
CONTENT=$(echo "$PR_TITLE" | cut -d ':' -f 2-)
CHANGELOG_ENTRY="**${CATEGORY}**\n${CONTENT}"
- name: Update Changelog
env:
GIT_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
if: success()
run: |
# Update changelog file
sed -i "1s/^/${CHANGELOG_ENTRY}\n\n/" Changelog.md
# Commit and push changelog update
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add Changelog.md
git commit -m "Update Changelog with changes from pull request #$PR_NUMBER"
git push origin HEAD