-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix workflow events are triggered in both the local and fork rep…
…ositories (#33)
- Loading branch information
Showing
6 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,3 +73,43 @@ func TestWorkflow_ConvertToArgoWorkflow(t *testing.T) { | |
assert.Equal(t, "", result) | ||
assert.Nil(t, err) | ||
} | ||
|
||
func Test_getProjectName(t *testing.T) { | ||
type args struct { | ||
projectName string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
name: "gaw1", | ||
args: args{ | ||
projectName: "https://github.com/LinuxSuRen/github-action-workflow.git", | ||
}, | ||
want: "LinuxSuRen/github-action-workflow", | ||
}, | ||
{ | ||
name: "gaw2", | ||
args: args{ | ||
projectName: "[email protected]:LinuxSuRen/github-action-workflow.git", | ||
}, | ||
want: "LinuxSuRen/github-action-workflow", | ||
}, | ||
{ | ||
name: "gaw3", | ||
args: args{ | ||
projectName: "[email protected]:group0/group1/LinuxSuRen/github-action-workflow.git", | ||
}, | ||
want: "group0/group1/LinuxSuRen/github-action-workflow", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := getProjectName(tt.args.projectName); got != tt.want { | ||
t.Errorf("getProjectName() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters