Skip to content
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

Add version bump checker GitHub Action #5

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makdefile,go.mod,go.sum,*.go,.gitmodules]
indent_style = tab
indent_size = 4

[*.{md,Rmd,rst}]
indent_size = 4
trim_trailing_whitespace = false
26 changes: 26 additions & 0 deletions .github/workflows/verBumpChkr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Version Bump Check

on:
pull_request:
types: [opened, reopened, synchronize]

env:
FILE_PATH: 'cmd/root.go' # Path to file with version string
VERSION_PATTERN: 'Version: "v[0-9]\+\.[0-9]\+\.[0-9]\+",' # Version string regex pattern

jobs:
version-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 2
- name: Check if Version String is Updated
run: |
if git diff -U0 --diff-filter 'AM' -r HEAD^1 HEAD -- "$FILE_PATH" | grep -q "$VERSION_PATTERN"; then
echo "##### ✅ Version updated in $FILE_PATH" >> "$GITHUB_STEP_SUMMARY"
else
echo "##### ❌ Version NOT updated in $FILE_PATH" >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,9 @@ func deduplicateSlice(s []string) []string {

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "timeBuddy",
Short: "CLI version of World Time Buddy",
Use: "timeBuddy",
Version: "v1.1.3",
Short: "CLI version of World Time Buddy",
Long: `timeBuddy is a Command Line Interface (CLI) tool designed to display the current time across multiple time zones. This
tool is particularly useful for scheduling meetings with participants in various time zones. By default, timeBuddy
includes your local time zone in its output. You can exclude your local time zone using the --exclude-local flag.
Expand Down Expand Up @@ -343,7 +344,6 @@ Examples:

Learn More:
To submit feature requests, bugs, or to check for new versions, visit https://github.com/JakeTRogers/timeBuddy`,
Version: "v1.1.1",
Args: func(cmd *cobra.Command, args []string) error {
// if the --date flag was provided, validate it
if cmd.Flags().Changed("date") {
Expand Down
Loading