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