-
-
Notifications
You must be signed in to change notification settings - Fork 22
chore: use human readable durations in the output of 'Tag a Release' workflow #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the output of the "Tag a Release" GitHub workflow by making the tag age information more human-readable and adding clearer logging messages. The changes enhance the user experience when monitoring the workflow's decision-making process.
- Enhanced human-readable time formatting for tag age display
- Added clearer logging messages to indicate workflow decisions
- Improved script robustness with better error handling and configuration
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
304b80d to
baa5368
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
baa5368 to
9f0576c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| human_readable_duration() { | ||
| local secs=$1 | ||
| local days=$((secs/86400)) | ||
| local hours=$((secs%86400/3600)) | ||
| local mins=$((secs%3600/60)) | ||
| if ((days > 0)); then | ||
| printf '%dd %dh %dm' "$days" "$hours" "$mins" | ||
| elif ((hours > 0)); then | ||
| printf '%dh %dm' "$hours" "$mins" | ||
| elif ((mins > 0)); then | ||
| printf '%dm' "$mins" | ||
| else | ||
| printf '%ds' "$((secs%60))" | ||
| fi | ||
| } |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function doesn't handle negative durations. If TAG_TIME is somehow in the future compared to NOW, this could result in negative values being passed to the function, leading to incorrect output.
| # 2 weeks minus 12 hours to ensure reliable 2 weeks timing of the daily cron job | ||
| MAX_AGE=$((14 * 24 * 3600 - 12 * 3600)) |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The magic number calculation for MAX_AGE could be made more readable by using intermediate variables or adding a comment explaining the specific values (14 days = 1209600 seconds, 12 hours = 43200 seconds).
| # 2 weeks minus 12 hours to ensure reliable 2 weeks timing of the daily cron job | |
| MAX_AGE=$((14 * 24 * 3600 - 12 * 3600)) | |
| # Calculate MAX_AGE as 2 weeks (14 days) minus 12 hours, in seconds. | |
| TWO_WEEKS_SECS=$((14 * 24 * 3600)) # 14 days = 1,209,600 seconds | |
| TWELVE_HOURS_SECS=$((12 * 3600)) # 12 hours = 43,200 seconds | |
| MAX_AGE=$((TWO_WEEKS_SECS - TWELVE_HOURS_SECS)) # 1,166,400 seconds |
No description provided.