Skip to content

Commit 283d93e

Browse files
committed
feat: init
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
0 parents  commit 283d93e

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Commit sync
2+
3+
Sync your gitlab commits history with gihub.
4+
5+
## Usage
6+
7+
```bash
8+
./script.sh
9+
```

script.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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

0 commit comments

Comments
 (0)