Skip to content

Commit

Permalink
Merge pull request #5 from JakeTRogers/feature/ver_bump_chkr
Browse files Browse the repository at this point in the history
Add version bump checker GitHub Action
  • Loading branch information
JakeTRogers authored Jan 13, 2024
2 parents 8362cdb + e136452 commit 9e139b7
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
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

0 comments on commit 9e139b7

Please sign in to comment.