File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Commit sync
2+
3+ Sync your gitlab commits history with gihub.
4+
5+ ## Usage
6+
7+ ``` bash
8+ ./script.sh
9+ ```
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # Create a git repo on github
3+ # Put this script inside
4+ # Update USERNAME
5+ # Run this script
6+ # Push
7+
8+ PRE_COMMIT_MSG=' auto: '
9+ USERNAME=' QuentinN42'
10+
11+ function modif(){
12+ cat changes | grep -q " true" && echo " false" > changes || echo " true" > changes
13+ }
14+
15+ todo=" $( curl -s " https://gitlab.com/users/${USERNAME} /calendar.json" | jq -rc ' . | to_entries | .[] | "\(.key)-\(range(.value)+1)"' ) "
16+ already_done=" $( git log --pretty=' format:%s' | grep -E " ^${PRE_COMMIT_MSG} " | sed " s/^${PRE_COMMIT_MSG} //" ) "
17+
18+ export IFS=$' \n '
19+ for x in $todo ;
20+ do
21+ echo " Processing ${x} "
22+ if [[ ! $already_done =~ $x ]]; then
23+ modif
24+ git add changes
25+ git commit -s -m " ${PRE_COMMIT_MSG}${x} " --date=" $( date -d " $( echo " ${x} " | cut -d- -f-3) " ) "
26+ fi
27+ done
You can’t perform that action at this time.
0 commit comments