robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

dependabot[bot]ci: bump actions/checkout in the github-actions group across 1 directory20f44076dc

master
1.8 KiB47 linesraw
1name: "news.txt"
2on:
3  pull_request:
4    types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
5    branches:
6    - 'master'
7
8permissions:
9  contents: read
10
11jobs:
12  check:
13    runs-on: ubuntu-latest
14    if: >-
15      github.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') ||
19        github.event.label.name == 'ci:skip-news'
20      )
21    steps:
22      - uses: actions/checkout@v7.0.1
23        with:
24          fetch-depth: 0
25          ref: ${{ github.event.pull_request.head.sha }}
26          persist-credentials: false
27      - name: news.txt needs to be updated
28        env:
29          PULL_REQUEST_COMMITS: ${{ github.event.pull_request.commits }}
30        run: |
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