From 7ee5fcd73ef1c348d08df6760294828db45ddb68 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Wed, 28 Feb 2024 11:23:11 +0100 Subject: [PATCH] meeting-reminder: Always evaluate week number as decimal In early weeks of the year `date -d "next Wednesday" "+%V"` returns a number of the form 01..09 which bash interprets as oktal number (base 8). Instead of stripping the leading zero we explicitly evaluate with base 10 aka decimal in the arithmetic expression now. Error output before was something like this for example: 08: value too great for base (error token is "08") Link: https://stackoverflow.com/a/11130324 Link: https://www.gnu.org/software/bash/manual/html_node/Shell-Arithmetic.html --- .github/workflows/meeting-reminder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/meeting-reminder.yaml b/.github/workflows/meeting-reminder.yaml index 8a3fee8..f6a0688 100644 --- a/.github/workflows/meeting-reminder.yaml +++ b/.github/workflows/meeting-reminder.yaml @@ -20,7 +20,7 @@ jobs: echo "next_date_iso=$next_date_iso" >> "$GITHUB_OUTPUT" echo "next_date_year=$next_date_year" >> "$GITHUB_OUTPUT" next_date_week=$(date -d "next Wednesday" "+%V") - if [[ $(($next_date_week % 3)) != 0 ]]; + if [[ $((10#$next_date_week % 3)) != 0 ]]; then echo "::notice::Wrong week, skip sending reminder." exit 1