mirror of
https://github.com/vee1e/gittuf.git
synced 2026-09-04 03:37:09 +00:00
gittuf has a companion app for GitHub that can record attestations for pull request reviews. Previously, the app was identified by its signing key. This commit adds initial support for naming the app, with an eye towards eventually supporting attestations from multiple apps. Signed-off-by: Aditya Sirish <aditya@saky.in>
45 lines
1 KiB
Go
45 lines
1 KiB
Go
// Copyright The gittuf Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package removegithubapp
|
|
|
|
import (
|
|
"github.com/gittuf/gittuf/experimental/gittuf"
|
|
"github.com/gittuf/gittuf/internal/cmd/common"
|
|
"github.com/gittuf/gittuf/internal/cmd/trust/persistent"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type options struct {
|
|
p *persistent.Options
|
|
}
|
|
|
|
func (o *options) AddFlags(_ *cobra.Command) {}
|
|
|
|
func (o *options) Run(cmd *cobra.Command, _ []string) error {
|
|
repo, err := gittuf.LoadRepository()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
signer, err := gittuf.LoadSigner(repo, o.p.SigningKey)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return repo.RemoveGitHubApp(cmd.Context(), signer, true)
|
|
}
|
|
|
|
func New(persistent *persistent.Options) *cobra.Command {
|
|
o := &options{p: persistent}
|
|
cmd := &cobra.Command{
|
|
Use: "remove-github-app",
|
|
Short: "Remove GitHub app from gittuf root of trust",
|
|
PreRunE: common.CheckForSigningKeyFlag,
|
|
RunE: o.Run,
|
|
DisableAutoGenTag: true,
|
|
}
|
|
o.AddFlags(cmd)
|
|
|
|
return cmd
|
|
}
|