2023-11-12 13:40:24 -07:00
|
|
|
name: "news.txt"
|
2022-12-05 03:58:30 -07:00
|
|
|
on:
|
|
|
|
pull_request:
|
2024-03-08 06:07:27 -07:00
|
|
|
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
|
2022-12-05 03:58:30 -07:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
runs-on: ubuntu-latest
|
2024-03-08 06:07:27 -07:00
|
|
|
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci:skip-news')
|
2022-12-05 03:58:30 -07:00
|
|
|
steps:
|
2023-09-04 05:51:40 -07:00
|
|
|
- uses: actions/checkout@v4
|
2022-12-05 03:58:30 -07:00
|
|
|
with:
|
2022-12-06 09:38:24 -07:00
|
|
|
fetch-depth: 0
|
2023-01-07 08:51:52 -07:00
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2022-12-05 03:58:30 -07:00
|
|
|
- name: news.txt needs to be updated
|
|
|
|
run: |
|
2022-12-06 09:38:24 -07:00
|
|
|
for commit in $(git rev-list HEAD~${{ github.event.pull_request.commits }}..HEAD); do
|
2022-12-05 03:58:30 -07:00
|
|
|
message=$(git log -n1 --pretty=format:%s $commit)
|
|
|
|
type="$(echo "$message" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')"
|
|
|
|
breaking="$(echo "$message" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')"
|
|
|
|
if [[ "$type" == "feat" ]] || [[ "$breaking" == "breaking-change" ]]; then
|
2022-12-06 09:38:24 -07:00
|
|
|
! git diff HEAD~${{ github.event.pull_request.commits }}..HEAD --quiet runtime/doc/news.txt ||
|
2022-12-05 03:58:30 -07:00
|
|
|
{
|
|
|
|
echo "
|
|
|
|
Pull request includes a new feature or a breaking change, but
|
2023-01-29 09:03:53 -07:00
|
|
|
news.txt hasn't been updated yet. This is just a reminder
|
|
|
|
that news.txt may need to be updated. You can ignore this CI
|
|
|
|
failure if you think the change won't be of interest to
|
|
|
|
users."
|
2022-12-05 03:58:30 -07:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
done
|