-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpublic_api_label_gate.sh
More file actions
27 lines (22 loc) · 738 Bytes
/
public_api_label_gate.sh
File metadata and controls
27 lines (22 loc) · 738 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
base_sha="${BASE_SHA:?BASE_SHA is required}"
head_sha="${HEAD_SHA:?HEAD_SHA is required}"
changed_snapshots="$(
git diff --name-only "$base_sha" "$head_sha" -- \
api/public/rustapi-rs.default.txt \
api/public/rustapi-rs.all-features.txt
)"
if [[ -z "$changed_snapshots" ]]; then
echo "No public API snapshot changes detected."
exit 0
fi
labels=",${PR_LABELS:-},"
if [[ "$labels" == *",breaking,"* || "$labels" == *",feature,"* ]]; then
echo "Public API snapshots changed and required label is present."
exit 0
fi
echo "::error::Public API snapshots changed but PR is missing required label: breaking or feature."
echo "Changed snapshot files:"
echo "$changed_snapshots"
exit 1