Skip to content

Commit 152eef6

Browse files
authored
Merge pull request #5 from MendixMobile/add-upstream-sync-action
Add Github Action: Scheduled upstream sync
2 parents 7eda702 + 238ba19 commit 152eef6

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/sync.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Sync Docs Fork with Upstream
2+
3+
on:
4+
schedule:
5+
# Daily at midnight (UTC).
6+
- cron: '0 0 * * *'
7+
workflow_dispatch: # Allow manual trigger from the GitHub UI.
8+
9+
jobs:
10+
sync:
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
DEFAULT_BRANCH: development
15+
UPSTREAM_REPO_URL: https://github.com/mendix/docs.git
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
20+
with:
21+
fetch-depth: 0
22+
ref: ${{ env.DEFAULT_BRANCH }}
23+
24+
- name: Configure Git
25+
run: |
26+
git config user.name "github-actions[bot]"
27+
git config user.email "github-actions[bot]@users.noreply.github.com"
28+
29+
- name: Add upstream remote and fetch
30+
run: |
31+
git remote add upstream ${{ env.UPSTREAM_REPO_URL }}
32+
git fetch upstream
33+
34+
- name: Merge upstream changes into default branch
35+
run: |
36+
git checkout ${{ env.DEFAULT_BRANCH }}
37+
git merge upstream/${{ env.DEFAULT_BRANCH }} --no-edit
38+
git push origin ${{ env.DEFAULT_BRANCH }}
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)