-
Notifications
You must be signed in to change notification settings - Fork 24
55 lines (51 loc) · 1.93 KB
/
stream-diff.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
44
45
46
47
48
49
50
51
52
53
54
55
---
name: Check stream diffs
on:
pull_request:
branches: [main]
paths: ["streams/*.json"]
permissions:
contents: read
jobs:
stream-diff:
name: Check stream diffs
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Genericize metadata
run: |
# Cache data from PR head
mkdir head
cp -r streams ci/genericize-stream.py head
# Switch to base
git checkout "${GITHUB_BASE_REF}"
# Get the `git describe` from fedora-coreos-stream-generator
git clone https://github.com/coreos/fedora-coreos-stream-generator
# matches https://github.com/coreos/fedora-coreos-stream-generator/blob/8ef5cb154645641a124c44105cbd482a9bbc115a/Makefile#L1
generator_tag=$(git -C fedora-coreos-stream-generator describe --dirty --always)
rm -rf fedora-coreos-stream-generator
echo "Current fedora-coreos-stream-generator: ${generator_tag}"
# Genericize metadata
mkdir -p {old,new}/streams
for stream in streams/*.json; do
if cmp -s "${stream}" "head/${stream}"; then
# Base and head identical; ignore stream to avoid false
# positives if the generator field is stale
echo "${stream} unchanged, skipping"
continue
fi
echo "${stream}, old"
# Pretend the old metadata used the latest tag of
# fedora-coreos-stream-generator.
head/genericize-stream.py -g "${generator_tag}" "${stream}" > "old/${stream}"
echo "${stream}, new"
head/genericize-stream.py "head/${stream}" > "new/${stream}"
done
- name: Compare genericized metadata
uses: coreos/actions-lib/check-diff@main
with:
basedir: old
patchdir: new