ci: sync workflows from main branch (#6730)

This commit is contained in:
Joe Chen
2022-01-16 19:51:14 +08:00
committed by GitHub
parent 2626bcf94f
commit 01a2c68abb
52 changed files with 190 additions and 260 deletions

View File

@@ -30,7 +30,9 @@ parse_generate_cron_expression() {
CRON_EXPR_DAYS="*"
CRON_EXPR_MONTHS="*"
# shellcheck disable=SC2001
TIME_INTERVAL=$(echo "${BACKUP_INTERVAL}" | sed -e 's/[hdM]$//')
# shellcheck disable=SC2001
TIME_UNIT=$(echo "${BACKUP_INTERVAL}" | sed -e 's/^[0-9]\+//')
if [ "${TIME_UNIT}" = "h" ]; then
@@ -74,7 +76,9 @@ parse_generate_cron_expression() {
parse_generate_retention_expression() {
FIND_TIME_EXPR='mtime'
# shellcheck disable=SC2001
TIME_INTERVAL=$(echo "${BACKUP_RETENTION}" | sed -e 's/[mhdM]$//')
# shellcheck disable=SC2001
TIME_UNIT=$(echo "${BACKUP_RETENTION}" | sed -e 's/^[0-9]\+//')
if [ "${TIME_UNIT}" = "m" ]; then

View File

@@ -17,10 +17,11 @@ main() {
fi
if [ ! -d "${BACKUP_PATH}" ]; then
echo "Error: BACKUP_PATH does't exist or is not a directory" 1>&2
echo "Error: BACKUP_PATH doesn't exist or is not a directory" 1>&2
exit 1
fi
# shellcheck disable=SC2086
find "${BACKUP_PATH}/" -type f -name "gogs-backup-*.zip" -${FIND_EXPRESSION} -print -exec rm "{}" +
}