Skip to content

Commit 27f0b4c

Browse files
HastDsecureblue-bot
authored andcommitted
ci: push tags and skip unnecessary rebases in sync workflow (#9)
* ci: push merged lightweight tags in sync workflow Since `--follow-tags` only pushes annotated tags, we need to separately list merged tags and push them by name. Signed-off-by: Daniel Hast <hast.daniel@protonmail.com> * ci: skip unnecessary rebases in sync workflow If the commit we would rebase to is already present on the working branch, we skip the rebase since that means we wouldn't be pushing any new commits. --------- Signed-off-by: Daniel Hast <hast.daniel@protonmail.com>
1 parent 5b21e5a commit 27f0b4c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/upstream-sync.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,19 @@ jobs:
4646
4747
spec_url="https://src.fedoraproject.org/rpms/selinux-policy/raw/f${FEDORA_VERSION}/f/selinux-policy.spec"
4848
stable_commit=$(curl -Ls "${spec_url}" | grep -E '^%global commit [0-9a-fA-F]+$')
49-
git rebase "${stable_commit#%global commit }"
50-
git push --follow-tags --force-with-lease
49+
stable_commit="${stable_commit#%global commit }"
50+
set +e
51+
git merge-base --is-ancestor "${stable_commit}" HEAD
52+
status=$?
53+
set -e
54+
case "${status}" in
55+
0) ;;
56+
1)
57+
git rebase "${stable_commit}"
58+
git push --follow-tags --force-with-lease
59+
;;
60+
*) exit "${status}" ;;
61+
esac
62+
63+
readarray -t merged_tags < <(git tag -l "v${FEDORA_VERSION}.*" --merged)
64+
git push origin "${merged_tags[@]}"

0 commit comments

Comments
 (0)