Skip to content

Commit 898754f

Browse files
committed
rename to ghp-sync
1 parent dfbf243 commit 898754f

22 files changed

+75
-68
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.DS_Store
22
.idea/
3-
ghp-repo-sync
3+
ghp-sync

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# ghp-repo-sync
1+
# ghp-sync
22

33
This is an application for dealing with GitHub Project Boards. This is intended to make sorting through issues and PRs in large repos faster and easier via the GitHub Project Board.
44

55
It can automatically add Issues or PRs to Project Boards based on the repo, organization, and project number.
66

77
When adding Issues to Project Boards with the Issue # and number of Days Open.
88

9-
ghp-repo-sync is still a work in progress with more automation to come in future!
9+
ghp-sync is still a work in progress with more automation to come in future!
1010

1111
## Installation
1212

13-
To install ghp-repo-sync from the command line, you can run:
13+
To install ghp-sync from the command line, you can run:
1414

15-
`go install ghp-repo-sync`
15+
`go install ghp-sync`
1616

1717
## Commands
1818

cli/cmds.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package cli
33
import (
44
"fmt"
55

6-
"github.com/katbyte/ghp-repo-sync/version" // todo - should we rename this (again) to ghp-sync ? if it can do project <> project & jira <> gh TODO yes we should
6+
"github.com/katbyte/ghp-sync/version" // todo - should we rename this (again) to ghp-sync ? if it can do project <> project & jira <> gh TODO yes we should
77
"github.com/spf13/cobra"
88
"github.com/spf13/viper"
99
)
@@ -28,7 +28,7 @@ func Make(cmdName string) (*cobra.Command, error) {
2828
SilenceErrors: true,
2929
PreRunE: ValidateParams([]string{"token", "repo", "project-owner", "project-number"}),
3030
RunE: func(cmd *cobra.Command, args []string) error {
31-
fmt.Println("USAGE: ghp-repo-syc [issues|prs] katbyte/ghp-repo-sync project")
31+
fmt.Println("USAGE: ghp-repo-syc [issues|prs] katbyte/ghp-sync project")
3232

3333
return nil
3434
},

cli/cmds_issues.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"time"
66

7-
"github.com/katbyte/ghp-repo-sync/lib/gh"
7+
"github.com/katbyte/ghp-sync/lib/gh"
88
"github.com/spf13/cobra"
99

1010
//nolint:misspell

cli/cmds_jira.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package cli
33
import (
44
"fmt"
55
"github.com/ctreminiom/go-atlassian/v2/pkg/infra/models"
6-
"github.com/katbyte/ghp-repo-sync/lib/gh"
7-
"github.com/katbyte/ghp-repo-sync/lib/j"
6+
"github.com/katbyte/ghp-sync/lib/gh"
7+
"github.com/katbyte/ghp-sync/lib/j"
88
"github.com/spf13/cobra"
99
"strings"
1010
"time"

cli/cmds_project.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cli
22

33
import (
44
"fmt"
5-
"github.com/katbyte/ghp-repo-sync/lib/gh"
5+
"github.com/katbyte/ghp-sync/lib/gh"
66
"github.com/spf13/cobra"
77
"strconv"
88
//nolint:misspell

cli/cmds_prs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"time"
88

99
"github.com/google/go-github/v45/github"
10-
"github.com/katbyte/ghp-repo-sync/lib/gh"
10+
"github.com/katbyte/ghp-sync/lib/gh"
1111
"github.com/spf13/cobra"
1212

1313
//nolint:misspell

cli/flags.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ type Filters struct {
2626
Assignees []string
2727
LabelsOr []string
2828
LabelsAnd []string
29+
30+
// todo move this to flags.project.Filters?
31+
ProjectStatusIs string
32+
ProjectFieldPopulated []string
2933
}
3034

3135
type Jira struct {
@@ -75,6 +79,8 @@ func configureFlags(root *cobra.Command) error {
7579
pflags.StringSliceVarP(&flags.Filters.Assignees, "assignees", "", []string{}, "sync prs assigned to these users. ie 'katbyte,assignee2,assignee3'")
7680
pflags.StringSliceVarP(&flags.Filters.LabelsOr, "labels-or", "l", []string{}, "filter that match any label conditions. ie 'label1,label2,-not-this-label'")
7781
pflags.StringSliceVarP(&flags.Filters.LabelsAnd, "labels-and", "", []string{}, "filter that match all label conditions. ie 'label1,label2,-not-this-label'")
82+
pflags.StringVarP(&flags.Filters.ProjectStatusIs, "project-status-is", "", "", "filter that match project status. ie 'In Progress'")
83+
pflags.StringSliceVarP(&flags.Filters.ProjectFieldPopulated, "project-fields-populated", "", []string{}, "filter that match project fields populated. ie 'Due Date'")
7884

7985
pflags.BoolVarP(&flags.DryRun, "dry-run", "d", false, "dry run, don't actually add issues/prs to project")
8086

@@ -86,6 +92,8 @@ func configureFlags(root *cobra.Command) error {
8692
"project-owner": "GITHUB_PROJECT_OWNER",
8793
"project-number": "GITHUB_PROJECT_NUMBER",
8894
"include-closed": "GITHUB_INCLUDE_CLOSED",
95+
"project-status-is": "GITHUB_PROJECT_STATUS_IS",
96+
"project-fields-populated": "GITHUB_PROJECT_FIELDS_POPULATED",
8997
"jira-url": "JIRA_URL",
9098
"jira-user": "JIRA_USER",
9199
"jira-jql": "JIRA_JQL",
@@ -142,6 +150,10 @@ func GetFlags() FlagData {
142150
if len(assignees) > 0 {
143151
assignees = strings.Split(assignees[0], ",")
144152
}
153+
projectFields := viper.GetStringSlice("project-fields-populated")
154+
if len(projectFields) > 0 {
155+
projectFields = strings.Split(projectFields[0], ",")
156+
}
145157

146158
// custom fields
147159
jiraCustomFieldsStr := viper.GetString("jira-custom-fields")
@@ -191,10 +203,12 @@ func GetFlags() FlagData {
191203
},
192204

193205
Filters: Filters{
194-
Authors: authors,
195-
Assignees: assignees,
196-
LabelsOr: viper.GetStringSlice("labels-or"),
197-
LabelsAnd: viper.GetStringSlice("labels-and"),
206+
Authors: authors,
207+
Assignees: assignees,
208+
LabelsOr: viper.GetStringSlice("labels-or"),
209+
LabelsAnd: viper.GetStringSlice("labels-and"),
210+
ProjectStatusIs: viper.GetString("project-status-is"),
211+
ProjectFieldPopulated: projectFields,
198212
},
199213
}
200214
}

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: "3.6"
22

33
services:
4-
ghp-repo-sync:
5-
image: ghp-repo-sync
6-
container_name: ghp-repo-sync
4+
ghp-sync:
5+
image: ghp-sync
6+
container_name: ghp-sync
77
environment:
88
- "TZ=America/Vancouver"
99
- "SYNC_CRON=0 0,3,6,9,12,15,18,21 * * *"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/katbyte/ghp-repo-sync
1+
module github.com/katbyte/ghp-sync
22

33
go 1.23
44

0 commit comments

Comments
 (0)