Skip to content

Commit c342153

Browse files
HastDsecureblue-bot
authored andcommitted
ci: add workflow to sync with upstream daily (#2)
This workflow runs the following steps daily: * Pull tags from upstream; * Rebase the default branch onto the latest tag for the current Fedora version; * Push the changes to the default branch, including tags. If the rebase encounters conflicts, the job will abort and conflicts will need to be resolved manually. Signed-off-by: Daniel Hast <hast.daniel@protonmail.com>
1 parent 7df17df commit c342153

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2025 The Secureblue Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: upstream-sync
16+
permissions: {}
17+
on:
18+
schedule:
19+
- cron: "00 2 * * *" # run daily at 2:00 UTC
20+
workflow_dispatch: # allow manually triggering sync
21+
22+
jobs:
23+
upstream-sync:
24+
name: Sync with upstream
25+
runs-on: ubuntu-24.04
26+
permissions:
27+
contents: write # Needed to modify repository contents
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
32+
with:
33+
persist-credentials: true # zizmor: ignore[artipacked]
34+
fetch-depth: 0
35+
36+
- name: Pull tags from upstream and rebase
37+
shell: bash
38+
env:
39+
FEDORA_VERSION: 42
40+
run: |
41+
git remote add 'upstream' 'https://github.com/fedora-selinux/selinux-policy.git'
42+
git fetch --tags 'upstream'
43+
latest_tag=$(git tag -l "v${FEDORA_VERSION}.*" --sort='-creatordate' | head -n1)
44+
git rebase "${latest_tag}"
45+
git push --follow-tags --force-with-lease

0 commit comments

Comments
 (0)