-
Notifications
You must be signed in to change notification settings - Fork 23
42 lines (35 loc) · 1.13 KB
/
sync-upstream.yaml
File metadata and controls
42 lines (35 loc) · 1.13 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
name: Sync upstream main
on:
schedule:
# Run nightly at 06:00 UTC (midnight CST)
- cron: '0 6 * * *'
workflow_dispatch: # Allow manual trigger
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout fork
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Add upstream remote
run: git remote add upstream https://github.com/ROCm/ATOM.git
- name: Fetch upstream
run: git fetch upstream main
- name: Check for new commits
id: check
run: |
BEHIND=$(git rev-list --count HEAD..upstream/main)
echo "behind=$BEHIND" >> "$GITHUB_OUTPUT"
echo "Fork is $BEHIND commit(s) behind upstream"
- name: Merge upstream
if: steps.check.outputs.behind != '0'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git merge upstream/main --no-edit
- name: Push
if: steps.check.outputs.behind != '0'
run: git push origin main