1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- name: Changelog
- on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
- workflow_dispatch:
- env:
- CARGO_UNSTABLE_SPARSE_REGISTRY: true
- CARGO_TERM_COLOR: always
- jobs:
- check-changelog:
- name: Check if CHANGELOG.md is updated
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Get latest updated files
- run: |
- updated_files=$(git show --name-only --pretty=format: HEAD)
- - name: Check if changlog is updated
- run: |
- if git show --name-only --pretty=format: HEAD | grep -q "CHANGELOG.md"; then
- echo "Main CHANGELOG.md changed in the latest commit."
- else
- echo "Main CHANGELOG.md is not changed in the latest commit."
- exit 1
- fi
- for file in $updated_files; do
- first_path=$(dirname "$file")
- if [[ "$first_path" == *"sbi-rt"* ]]; then
- file_path = "./sbi-rt"
- elif [[ "$first_path" == *"sbi-spec"* ]]; then
- file_path = "./sbi-spec"
- elif [[ "$first_path" == *"sbi-testing"* ]]; then
- file_path = "./sbi-testing"
- else
- file_path = "./"
- fi
- changelog_path="$file_path/CHANGELOG.md"
- # Check if changelog is updated
- if git diff --name-only "$file_path" | grep -q "CHANGELOG.md"; then
- echo "File $changelog_path changed in the latest commit."
- else
- echo "File $changelog_path is not changed in the latest commit."
- exit 1
- fi
- done
|