Initial commit
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Han Dai 2020-02-29 23:28:34 -05:00
parent 6996cf1a78
commit c36f1a3068
2 changed files with 52 additions and 0 deletions

13
.drone.yml Normal file
View File

@ -0,0 +1,13 @@
kind: pipeline
type: docker
name: default
steps:
- name: Github
image: alpine/git
environment:
Github:
from_secret: Github
commands:
- chmod +x commit.sh
- ./commit.sh $Github

39
commit.sh Normal file
View File

@ -0,0 +1,39 @@
#!/bin/bash
# usage ./commit.sh https://username:password@git.domain.tld/username/repo.git
git clone $1 target
cd target
git config user.email "10000@daihan.me"
git config user.name "Han Dai"
wget https://gitea.dennx.com/api/v1/users/dennydai/heatmap -O heatmap
heatmap=$(cat heatmap | grep -Po [0-9]+)
mkdir -p history
column=0 # 0: timestamp, 1: # of contributions
for i in $heatmap
do
if [ $column = 0 ] # timestamp
then column=1
timestamp=$i
else column=0 # # of contributions
synced=0 # synced # of contributions
if [ ! -f history/$timestamp ]
then echo "0" > history/$timestamp
else synced=$(cat history/$timestamp)
fi
for j in $(seq $(expr $synced + 1) $i)
do
echo $j > history/$timestamp
git add . -A
export GIT_AUTHOR_DATE=$timestamp
export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
git commit -m "Sync Contribution Heatmap from Gitea"
done
fi
done
git push -u origin master