Skip to content

Commit 6190819

Browse files
authored
Merge pull request #205 from ianm-nv/linux-nvidia-6.12
NVIDIA: SAUCE: ci: add workflow to rebase linux-nvidia-6.12 onto latest v6.12.x
2 parents 87a0d31 + 130f3f4 commit 6190819

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Update and Rebase
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-rebase-branch:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout current branch
13+
uses: actions/checkout@v4
14+
with:
15+
ref: ${{ github.ref_name }}
16+
fetch-depth: 0
17+
18+
- name: Add upstream remote (if not exists)
19+
run: |
20+
if ! git remote | grep -q upstream; then
21+
git remote add upstream https://github.com/gregkh/linux.git
22+
fi
23+
24+
- name: Fetch upstream tags
25+
run: git fetch upstream --tags
26+
27+
- name: Find latest stable tag for branch
28+
id: latest_tag
29+
run: |
30+
version=$(echo ${{ github.ref_name }} | sed 's/^linux-nvidia-//')
31+
tag=$(git describe --abbrev=0 --tags upstream/linux-${version}.y)
32+
echo "tag=$tag" >> $GITHUB_OUTPUT
33+
34+
- name: Fetch patch branch
35+
run: git fetch origin ${{ github.ref_name }}
36+
37+
- name: Find merge base between patch branch and updated LTS
38+
id: merge_base
39+
run: |
40+
base=$(git merge-base origin/${{ github.ref_name }} ${{ steps.latest_tag.outputs.tag }})
41+
echo "base=$base" >> $GITHUB_OUTPUT
42+
43+
- name: Create new branch for rebased patches
44+
run: |
45+
git checkout -b ${{ github.ref_name }}-${{ steps.latest_tag.outputs.tag }} origin/${{ github.ref_name }}
46+
47+
- name: Set git user identity
48+
run: |
49+
git config --local user.name "github-actions[bot]"
50+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
51+
52+
- name: Rebase patch branch onto updated LTS
53+
run: |
54+
git rebase --onto ${{ steps.latest_tag.outputs.tag }} ${{ steps.merge_base.outputs.base }}
55+
56+
- name: Push rebased patch branch
57+
run: |
58+
git push --force origin HEAD:${{ github.ref_name }}-${{ steps.latest_tag.outputs.tag }}

0 commit comments

Comments
 (0)