forked from cross-rs/cross
-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (39 loc) · 1.32 KB
/
changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
on:
pull_request:
types: [labeled, unlabeled, opened, synchronize, reopened]
name: Changelog check
jobs:
changelog:
name: Changelog check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
- name: Get Changed Files
id: files
uses: tj-actions/changed-files@v34
with:
separator: ';'
files: |
.changes/*.json
- name: Validate Changelog Files
id: changelog
run: |
set -x
set -e
IFS=';' read -a added_modified <<< '${{ steps.files.outputs.all_changed_files }}'
IFS=';' read -a removed <<< '${{ steps.files.outputs.deleted_files }}'
added_count=${#added_modified[@]}
removed_count=${#removed[@]}
if ${{ !contains(github.event.pull_request.labels.*.name, 'no changelog' ) }}; then
if [[ "$added_count" -eq "0" ]] && [[ "$removed_count" -eq "0" ]]; then
echo "Must add or remove changes or add the 'no changelog' label"
exit 1
else
basenames=()
for path in "${added_modified[@]}"; do
basenames+=($(basename "${path}"))
done
cargo xtask validate-changelog "${basenames[@]}"
fi
fi