Skip to content

Commit

Permalink
Addresses OpenHistoricalMap/issues#786 by adding a new workflow and a…
Browse files Browse the repository at this point in the history
…ssociated bash script.
  • Loading branch information
erictheise committed Jul 6, 2024
1 parent 4d08875 commit 1c07ace
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ohm.upstream-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Upstream Sync

on:
schedule:
- cron: "20 5,17 * * *"
workflow_dispatch:

jobs:
upstream-sync:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./scripts
steps:
- name: Check out the repository to the runner
uses: actions/checkout@v4
- name: Make the script files executable
run: chmod +x upstream_sync.sh
- name: Run sync script
uses: upstream_sync.sh
36 changes: 36 additions & 0 deletions scripts/upstream_sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

#
#
#

git checkout main
git branch -D the-sacrifice
git checkout -b the-sacrifice
git fetch upstream master

mkdir upstream
for i in $(git ls-tree upstream/master --name-only); do
if [[ $i == *.md ]];then
git show upstream/master:$i > upstream/$i
fi
done
git show upstream/master:LICENSE > upstream/LICENSE
git add upstream
git commit -m 'Preserving upstream markdown & text files.'

git merge --no-ff --no-commit upstream/master
concerns=('js/ide.js' 'js/map.ts')
for i in $(git diff --name-only --diff-filter=U --relative);do
echo "$i"
for c in "${concerns[@]}";do
echo "$c"
if [[ $i != $c ]];then
git checkout --theirs -- $i
git add $i
fi
done
done

iso=$(date -Iminutes)
git commit -m "Merge upstream ("$iso")."

0 comments on commit 1c07ace

Please sign in to comment.