Skip to content

Commit 40ddc1b

Browse files
MarcelCodinggithub-actions[bot]
authored andcommitted
gh-actions: add automatic rebase
1 parent ac35b10 commit 40ddc1b

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/rebase.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Rebase upstream
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "15 14 * * *"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
rebase:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- target: "nixos-unstable"
20+
upstream: "nixos-unstable"
21+
- target: "nixos-24.11"
22+
upstream: "nixos-24.11"
23+
- target: "backports-24.11"
24+
upstream: "nixos-24.11"
25+
- target: "nixos-24.05"
26+
upstream: "nixos-24.05"
27+
- target: "backports-24.05"
28+
upstream: "nixos-24.05"
29+
30+
steps:
31+
- uses: actions/cache@v4
32+
with:
33+
path: .git
34+
key: ${{ matrix.target }}-git-${{ hashFiles('.git') }}
35+
restore-keys: |
36+
${{ matrix.target }}-git-
37+
38+
- uses: actions/checkout@v4
39+
with:
40+
ref: ${{ matrix.target }}
41+
fetch-depth: 300
42+
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
43+
44+
- name: git setup
45+
run: |
46+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
47+
git config --local user.name "github-actions[bot]"
48+
49+
- name: fetch upstream
50+
run: |
51+
# might already be there if the cache was used
52+
git remote add upstream https://github.com/NixOS/nixpkgs.git || true
53+
git fetch --no-tags --prune --no-recurse-submodules --depth 2000 upstream ${{ matrix.upstream }}
54+
55+
- name: rebase
56+
run: |
57+
git rebase upstream/${{ matrix.upstream }}
58+
59+
- name: push
60+
run: |
61+
git push --force-with-lease origin ${{ matrix.target }}
62+
63+
- name: collect garbage
64+
run: |
65+
git gc

0 commit comments

Comments
 (0)