add additional check for empty pad
This commit is contained in:
parent
6423d1dc04
commit
e1ecb7dc05
2 changed files with 18 additions and 13 deletions
|
@ -8,4 +8,4 @@ include:
|
||||||
file: 'lib/gitlab-ci.yml'
|
file: 'lib/gitlab-ci.yml'
|
||||||
```
|
```
|
||||||
|
|
||||||
The including CI configuration has to provide a `CI_ACCESS_TOKEN` that can push to the repo.
|
The project including the CI configuration has to provide the variable `CI_ACCESS_TOKEN`. It must contain a project access token that can push to the repo.
|
||||||
|
|
15
update
15
update
|
@ -8,10 +8,17 @@ update() {
|
||||||
|
|
||||||
curl --silent -k -o "${dst}" "${url}/export/txt"
|
curl --silent -k -o "${dst}" "${url}/export/txt"
|
||||||
status="$?"
|
status="$?"
|
||||||
|
|
||||||
if [ ${status} -ne 0 ]; then
|
if [ ${status} -ne 0 ]; then
|
||||||
echo "Failed to get pad at ${url}"
|
echo "Failed to get pad at ${url}"
|
||||||
else
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
newlength="$(wc -l ${dst})"
|
||||||
|
if [ "$newlength" -lt 3 ]
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
git -C "${gitdir}" add "${dst}"
|
git -C "${gitdir}" add "${dst}"
|
||||||
changes=$(git -C "${gitdir}" diff --cached | wc -l)
|
changes=$(git -C "${gitdir}" diff --cached | wc -l)
|
||||||
if [ "$changes" -gt 0 ]; then
|
if [ "$changes" -gt 0 ]; then
|
||||||
|
@ -19,9 +26,6 @@ update() {
|
||||||
else
|
else
|
||||||
echo "Nothing changed for ${url}"
|
echo "Nothing changed for ${url}"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
git -C "${gitdir}" reset --hard HEAD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! git rev-parse --is-inside-work-tree
|
if ! git rev-parse --is-inside-work-tree
|
||||||
|
@ -33,4 +37,5 @@ fi
|
||||||
while read -r pad
|
while read -r pad
|
||||||
do
|
do
|
||||||
update "$pad"
|
update "$pad"
|
||||||
|
git -C "${gitdir}" reset --hard HEAD
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue