aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2022-12-05 11:58:30 +0100
committerGitHub <noreply@github.com>2022-12-05 11:58:30 +0100
commit6c285a6e49ba39eefff9e4aabd97df1cbe5eeedd (patch)
tree11eff5e545a4d9cc8d8d51c5d67c2cc4bdac7a7f
parent5c52971f603d35aa689022eb0a0bc670ab6788e6 (diff)
downloadrneovim-6c285a6e49ba39eefff9e4aabd97df1cbe5eeedd.tar.gz
rneovim-6c285a6e49ba39eefff9e4aabd97df1cbe5eeedd.tar.bz2
rneovim-6c285a6e49ba39eefff9e4aabd97df1cbe5eeedd.zip
ci: create CI job to check if news needs to be updated (#21142)
If any commit message in the PR is either of type "feat" or is a breaking change, then there's a high probability that news.txt should be updated. Give an error if news.txt hasn't been updated in that case. This workflow cannot 100% correctly determine if news.txt should be updated even if the commit messages were exactly correct. The entries in news.txt is determined by changes between releases, while the commit messages are based on the master branch. While it is an approximation, it is still a useful enough one that it's still valuable to have this job as a reminder even if it gives an error if it shouldn't. In these cases it is perfectly fine to ignore the failure for this job.
-rw-r--r--.github/workflows/news.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/.github/workflows/news.yml b/.github/workflows/news.yml
new file mode 100644
index 0000000000..c838c150fe
--- /dev/null
+++ b/.github/workflows/news.yml
@@ -0,0 +1,31 @@
+name: "news.txt check"
+on:
+ pull_request:
+ branches:
+ - 'master'
+jobs:
+ check:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ fetch-depth: ${{ github.event.pull_request.commits }}
+ - name: news.txt needs to be updated
+ run: |
+ for commit in $(git rev-list HEAD); do
+ 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
+ git diff HEAD~$((${{ github.event.pull_request.commits }}-1)) --name-only | grep runtime/doc/news.txt ||
+ {
+ echo "
+ Pull request includes a new feature or a breaking change, but
+ news.txt hasn't been updated yet. news.txt is our primary way of
+ communicating changes to users so it's important to keep it up to
+ date."
+ exit 1
+ }
+ fi
+ done