forked from ghostty-org/ghostty
-
Notifications
You must be signed in to change notification settings - Fork 6
50 lines (42 loc) · 1.35 KB
/
sync-upstream.yml
File metadata and controls
50 lines (42 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Sync with Upstream
on:
schedule:
# Run daily at 6am UTC
- cron: "0 6 * * *"
workflow_dispatch:
# Allow manual trigger
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Add upstream remote
run: git remote add upstream https://github.com/ghostty-org/ghostty.git
- name: Fetch upstream
run: git fetch upstream
- name: Check if rebase needed
id: check
run: |
BEHIND=$(git rev-list --count main..upstream/main)
echo "behind=$BEHIND" >> $GITHUB_OUTPUT
if [ "$BEHIND" -eq 0 ]; then
echo "Already up to date with upstream"
else
echo "Main is $BEHIND commits behind upstream"
fi
- name: Rebase onto upstream
if: steps.check.outputs.behind != '0'
run: |
git checkout main
git rebase upstream/main
- name: Push changes
if: steps.check.outputs.behind != '0'
run: git push --force-with-lease origin main