-
Notifications
You must be signed in to change notification settings - Fork 24
57 lines (53 loc) · 1.9 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
56
57
---
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 numerically latest fedora-coreos-stream-generator tag
generator_tag=$(
curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/coreos/fedora-coreos-stream-generator/git/matching-refs/tags/ |
jq -r .[].ref |
sed s:^refs/tags/:: |
sort -V |
tail -n 1)
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