-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add output variables support for gha and bitrise (#9)
* add output variables support for gha and bitrise plugins * change * change * review changes
- Loading branch information
1 parent
19bfe2f
commit 1c16468
Showing
12 changed files
with
259 additions
and
36 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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package bitrise | ||
|
||
// envStore ... | ||
type envStore struct { | ||
Envs []map[string]string `json:"envs" yaml:"envs"` | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2022 Harness Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// Package harness provides support for executing Github plugins. | ||
package github | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
// Is returns true if the root path is a Harness | ||
// plugin repository. | ||
func Is(root string) bool { | ||
path := filepath.Join(root, "action.yml") | ||
if _, err := os.Stat(path); err == nil { | ||
return true | ||
} | ||
path = filepath.Join(root, "action.yaml") | ||
if _, err := os.Stat(path); err == nil { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func getYamlFilename(root string) string { | ||
if _, err := os.Stat(filepath.Join(root, "action.yml")); err == nil { | ||
return filepath.Join(root, "action.yml") | ||
} | ||
if _, err := os.Stat(filepath.Join(root, "action.yaml")); err == nil { | ||
return filepath.Join(root, "action.yaml") | ||
} | ||
return "" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2022 Harness Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package github | ||
|
||
import ( | ||
"net/url" | ||
"strings" | ||
) | ||
|
||
// ParseLookup parses the step string and returns the | ||
// associated repository and ref. | ||
func ParseLookup(s string) (repo string, ref string, ok bool) { | ||
if !strings.HasPrefix(s, "https://github.com") { | ||
s, _ = url.JoinPath("https://github.com", s) | ||
} | ||
|
||
if parts := strings.SplitN(s, "@", 2); len(parts) == 2 { | ||
return parts[0], parts[1], true | ||
} | ||
return s, "", true | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2022 Harness Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package github | ||
|
||
import ( | ||
"io/ioutil" | ||
|
||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
// helper function to parse the bitrise plugin yaml. | ||
func parse(b []byte) (*spec, error) { | ||
out := new(spec) | ||
err := yaml.Unmarshal(b, out) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return out, nil | ||
} | ||
|
||
// helper function to parse the bitrise plugin yaml file. | ||
func parseFile(s string) (*spec, error) { | ||
raw, err := ioutil.ReadFile(s) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return parse(raw) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright 2022 Harness Inc. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package github | ||
|
||
// spec defines the bitrise plugin. | ||
type spec struct { | ||
Outputs map[string]interface{} `yaml:"outputs"` | ||
} |
Oops, something went wrong.