Skip to content

Commit ab0e02e

Browse files
HastDsecureblue-bot
authored andcommitted
fix: get version number from upstream RPM spec (#4)
This makes the action sync the repo with the upstream tag that the selinux-policy RPM spec for the current Fedora version uses, not the most recent tag (which is often only on rawhide, not stable). Signed-off-by: Daniel Hast <hast.daniel@protonmail.com>
1 parent 2ab03a0 commit ab0e02e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/upstream-sync.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ jobs:
3838
env:
3939
FEDORA_VERSION: 42
4040
run: |
41-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
42-
git config user.name "github-actions[bot]"
41+
set -euxo pipefail
42+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
43+
git config user.name 'github-actions[bot]'
4344
git remote add 'upstream' 'https://github.com/fedora-selinux/selinux-policy.git'
4445
git fetch --tags 'upstream'
45-
latest_tag=$(git tag -l "v${FEDORA_VERSION}.*" --sort='-creatordate' | head -n1)
46-
git rebase "${latest_tag}"
46+
47+
spec_url="https://src.fedoraproject.org/rpms/selinux-policy/raw/f${FEDORA_VERSION}/f/selinux-policy.spec"
48+
stable_version=$(curl -Ls "${spec_url}" | grep '^Version: .*')
49+
git rebase "v${stable_version#Version: }"
4750
git push --follow-tags --force-with-lease

0 commit comments

Comments
 (0)