Skip to content

Commit cbb9332

Browse files
committed
Setup auto sync fork for main branch
1 parent c9f2538 commit cbb9332

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/sync_fork.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Sync Fork
2+
run-name: Sync Fork
3+
on:
4+
schedule:
5+
- cron: '58 23 * * *' # run every day - two minutes to midnight
6+
workflow_dispatch: # to enable manual runs of the workflow
7+
8+
jobs:
9+
Get-Timestamp:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- run: date
13+
14+
Sync-With-Upstream:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
18+
- run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub"
19+
- run: echo "Running on branch ${{ github.ref }}, repository ${{ github.repository }}."
20+
- name: Check out repository code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- run: echo "The ${{ github.repository }} repository has been cloned to the runner."
25+
- name: List files in the repository
26+
run: |
27+
ls ${{ github.workspace }}
28+
- name: Sync repository with upstream
29+
run: |
30+
cd ${{ github.workspace }}
31+
git config --global user.email "jcarmona@eso.org"
32+
git config --global user.name "Nightly Sync"
33+
git remote add upstream https://github.com/astropy/astroquery.git
34+
git remote -v
35+
git fetch upstream main
36+
echo "--- upstream log: "
37+
git log upstream/main --oneline -10
38+
echo "--- current branch log before merge: "
39+
git log --oneline -10
40+
git merge upstream/main
41+
echo "--- current branch log after merge: "
42+
git log --oneline -10
43+
echo "--- push force with lease"
44+
git push --force-with-lease
45+
- run: echo "The job finished with status ${{ job.status }}."

0 commit comments

Comments
 (0)