Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Created April 12, 2024 20:48
Show Gist options
  • Select an option

  • Save KyMidd/ef6d1c7da42884c91e9d67332453e5ea to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/ef6d1c7da42884c91e9d67332453e5ea to your computer and use it in GitHub Desktop.
# Convert the last active date to epoc
# This uses branching logic because macs don't use GNUtils date
if [ -z "$local_testing" ]; then
last_active_date_in_epoc=$(date -d $last_active_date +"%s")
else
last_active_date_in_epoc=$(date -juf "%Y-%m-%dT%H:%M:%S" $last_active_date +%s 2>/dev/null)
fi
# Check if the last active date epoc is less than a month ago
if (( $last_active_date_in_epoc < $date_one_month_ago )); then
echo "🔴 User $copilot_user is inactive for more than a month, disabling copilot for user"
remove_user_from_copilot
continue
else
echo "🟢 User $copilot_user is active in the last month"
fi
done <<< "$copilot_all_users"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment