Skip to content

Commit b191016

Browse files
Merge pull request #17 from rh-ecosystem-edge/check-kernel-versions
Add github workflow to check for new kernels
2 parents 6317aab + fcf2848 commit b191016

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Check Kernel Versions
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-kernel-versions:
10+
runs-on: ubuntu-latest
11+
container: registry.redhat.io/ubi9/ubi:9.5
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Install dnf-utils
17+
run: dnf install -y dnf-utils
18+
19+
- name: Fetch available kernel-devel versions
20+
run: dnf search kernel-devel --showduplicates | awk '{print $1}' | sort -u > kernel_versions.txt
21+
22+
- name: Compare with previous version
23+
run: |
24+
if [ -f previous_kernel_versions.txt ]; then
25+
diff_output=$(diff previous_kernel_versions.txt kernel_versions.txt)
26+
if [ -n "$diff_output" ]; then
27+
echo "New version found!"
28+
echo "$diff_output"
29+
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
30+
fi
31+
else
32+
echo "First run, no previous version to compare."
33+
fi
34+
35+
- name: Update stored versions if changed
36+
if: env.CHANGES_DETECTED == 'true'
37+
run: |
38+
mv kernel_versions.txt previous_kernel_versions.txt
39+
git config --global user.name "github-actions[bot]"
40+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
41+
git add previous_kernel_versions.txt
42+
git commit -m "Update kernel versions list"
43+
git push

0 commit comments

Comments
 (0)