fix: reset vuln-list (#274)

Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
Teppei Fukuda 2024-02-23 21:41:00 +04:00 committed by GitHub
parent 9d5c9da3de
commit d4135c9f51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,13 +1,4 @@
#!/bin/bash -eEu
HEAD=$(git rev-parse HEAD)
shopt -s inherit_errexit
on_error() {
echo "[Err] Revert changes" >&2
git reset --hard "${HEAD}"
exit 1
}
trap on_error ERR
#!/bin/bash -eu
TARGET=$1
COMMIT_MSG=$2
@ -22,7 +13,14 @@ if [ -z "$COMMIT_MSG" ]; then
exit 1
fi
./vuln-list-update -vuln-list-dir "$VULN_LIST_DIR" -target "$TARGET"
result=0
./vuln-list-update -vuln-list-dir "$VULN_LIST_DIR" -target "$TARGET" || result=$?
if [ $result -ne 0 ]; then
echo "[Err] Revert changes" >&2
cd "$VULN_LIST_DIR" && git reset --hard HEAD
exit 1
fi
cd "$VULN_LIST_DIR" || exit 1