|
|
@@ -32,11 +32,12 @@ type GithubActions struct {
|
|
|
GithubAppSecretPath string
|
|
|
GithubInstallationID uint
|
|
|
|
|
|
- PorterToken string
|
|
|
- BuildEnv map[string]string
|
|
|
- ProjectID uint
|
|
|
- ClusterID uint
|
|
|
- ReleaseName string
|
|
|
+ WebhookToken string
|
|
|
+ PorterToken string
|
|
|
+ BuildEnv map[string]string
|
|
|
+ ProjectID uint
|
|
|
+ ClusterID uint
|
|
|
+ ReleaseName string
|
|
|
|
|
|
GitBranch string
|
|
|
DockerFilePath string
|
|
|
@@ -100,8 +101,17 @@ func (g *GithubActions) Cleanup() error {
|
|
|
|
|
|
g.defaultBranch = repo.GetDefaultBranch()
|
|
|
|
|
|
+ // delete the webhook token secret
|
|
|
+ err = g.deleteGithubSecret(client, g.getWebhookSecretName())
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
// delete the env secret
|
|
|
- if err := g.deleteGithubSecret(client, g.getBuildEnvSecretName()); err != nil {
|
|
|
+ err = g.deleteGithubSecret(client, g.getBuildEnvSecretName())
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
@@ -294,6 +304,12 @@ func (g *GithubActions) createEnvSecret(client *github.Client) error {
|
|
|
return g.createGithubSecret(client, secretName, strings.Join(lines, "\n"))
|
|
|
}
|
|
|
|
|
|
+func (g *GithubActions) getWebhookSecretName() string {
|
|
|
+ return fmt.Sprintf("WEBHOOK_%s", strings.Replace(
|
|
|
+ strings.ToUpper(g.ReleaseName), "-", "_", -1),
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
func (g *GithubActions) getBuildEnvSecretName() string {
|
|
|
return fmt.Sprintf("ENV_%s", strings.Replace(
|
|
|
strings.ToUpper(g.ReleaseName), "-", "_", -1),
|