Changelog.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. name: Changelog
  2. on:
  3. push:
  4. branches: [ "main" ]
  5. pull_request:
  6. branches: [ "main" ]
  7. workflow_dispatch:
  8. env:
  9. CARGO_UNSTABLE_SPARSE_REGISTRY: true
  10. CARGO_TERM_COLOR: always
  11. jobs:
  12. check-changelog:
  13. name: Check if CHANGELOG.md is updated
  14. runs-on: ubuntu-latest
  15. steps:
  16. - uses: actions/checkout@v4
  17. - name: Get latest updated files
  18. run: |
  19. updated_files=$(git show --name-only --pretty=format: HEAD)
  20. - name: Check if changlog is updated
  21. run: |
  22. if git show --name-only --pretty=format: HEAD | grep -q "CHANGELOG.md"; then
  23. echo "Main CHANGELOG.md changed in the latest commit."
  24. else
  25. echo "Main CHANGELOG.md is not changed in the latest commit."
  26. exit 1
  27. fi
  28. for file in $updated_files; do
  29. first_path=$(dirname "$file")
  30. if [[ "$first_path" == *"sbi-rt"* ]]; then
  31. file_path = "./sbi-rt"
  32. elif [[ "$first_path" == *"sbi-spec"* ]]; then
  33. file_path = "./sbi-spec"
  34. elif [[ "$first_path" == *"sbi-testing"* ]]; then
  35. file_path = "./sbi-testing"
  36. else
  37. file_path = "./"
  38. fi
  39. changelog_path="$file_path/CHANGELOG.md"
  40. # Check if changelog is updated
  41. if git diff --name-only "$file_path" | grep -q "CHANGELOG.md"; then
  42. echo "File $changelog_path changed in the latest commit."
  43. else
  44. echo "File $changelog_path is not changed in the latest commit."
  45. exit 1
  46. fi
  47. done