diff --git a/.drone.yml b/.drone.yml index 2db6aad..a47bf0e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,7 +25,7 @@ pipeline: image: plugins/docker:17.05 pull: true repo: plugins/git - tags: [ latest, 1.3.0, 1.3, 1 ] + tags: [ latest, 1.4.0, 1.4, 1 ] secrets: [ docker_username, docker_password ] dockerfile: Dockerfile when: diff --git a/plugin.go b/plugin.go index 593f551..52ac356 100644 --- a/plugin.go +++ b/plugin.go @@ -38,12 +38,12 @@ func (p Plugin) Exec() error { cmds = append(cmds, remote(p.Repo.Clone)) } + cmds = append(cmds, fetch(p.Build.Ref, p.Config.Tags, p.Config.Depth)) + switch { - case isPullRequest(p.Build.Event) || isTag(p.Build.Event, p.Build.Ref): - cmds = append(cmds, fetch(p.Build.Ref, p.Config.Tags, p.Config.Depth)) + case isTag(p.Build.Event, p.Build.Ref): cmds = append(cmds, checkoutHead()) default: - cmds = append(cmds, fetch(p.Build.Ref, p.Config.Tags, p.Config.Depth)) cmds = append(cmds, checkoutSha(p.Build.Commit)) } diff --git a/plugin_test.go b/plugin_test.go index 1cbe40d..046652e 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -48,7 +48,7 @@ var commits = []struct { clone: "https://github.com/octocat/Hello-World.git", event: "pull_request", branch: "master", - commit: "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e", + commit: "43617d6cc59d91c7d99909042c19ff122e2597fb", ref: "refs/pull/208/merge", file: "README", data: "Goodbye World!\n", diff --git a/utils.go b/utils.go index 896c551..85b960d 100644 --- a/utils.go +++ b/utils.go @@ -29,11 +29,6 @@ func isDirEmpty(dir string) bool { return err == io.EOF } -// helper function returns true if the commit is a pull_request. -func isPullRequest(event string) bool { - return event == "pull_request" -} - // helper function returns true if the commit is a tag. func isTag(event, ref string) bool { return event == "tag" ||