news.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. name: "news.txt"
  2. on:
  3. pull_request:
  4. types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
  5. branches:
  6. - 'master'
  7. jobs:
  8. check:
  9. runs-on: ubuntu-latest
  10. if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci:skip-news')
  11. steps:
  12. - uses: actions/checkout@v4
  13. with:
  14. fetch-depth: 0
  15. ref: ${{ github.event.pull_request.head.sha }}
  16. - name: news.txt needs to be updated
  17. run: |
  18. for commit in $(git rev-list HEAD~${{ github.event.pull_request.commits }}..HEAD); do
  19. message=$(git log -n1 --pretty=format:%s $commit)
  20. type="$(echo "$message" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')"
  21. breaking="$(echo "$message" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')"
  22. if [[ "$type" == "feat" ]] || [[ "$breaking" == "breaking-change" ]]; then
  23. ! git diff HEAD~${{ github.event.pull_request.commits }}..HEAD --quiet runtime/doc/news.txt ||
  24. {
  25. echo "
  26. Pull request includes a new feature or a breaking change, but
  27. news.txt hasn't been updated yet. This is just a reminder
  28. that news.txt may need to be updated. You can ignore this CI
  29. failure if you think the change won't be of interest to
  30. users."
  31. exit 1
  32. }
  33. fi
  34. done